You are here

class ConsoleCommandEvent in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/console/Event/ConsoleCommandEvent.php \Symfony\Component\Console\Event\ConsoleCommandEvent

Allows to do things before the command is executed, like skipping the command or changing the input.

@author Fabien Potencier <fabien@symfony.com>

Hierarchy

Expanded class hierarchy of ConsoleCommandEvent

2 files declare their use of ConsoleCommandEvent
Application.php in vendor/symfony/console/Application.php
ApplicationTest.php in vendor/symfony/console/Tests/ApplicationTest.php

File

vendor/symfony/console/Event/ConsoleCommandEvent.php, line 19

Namespace

Symfony\Component\Console\Event
View source
class ConsoleCommandEvent extends ConsoleEvent {

  /**
   * The return code for skipped commands, this will also be passed into the terminate event.
   */
  const RETURN_CODE_DISABLED = 113;

  /**
   * Indicates if the command should be run or skipped.
   *
   * @var bool
   */
  private $commandShouldRun = true;

  /**
   * Disables the command, so it won't be run.
   *
   * @return bool
   */
  public function disableCommand() {
    return $this->commandShouldRun = false;
  }

  /**
   * Enables the command.
   *
   * @return bool
   */
  public function enableCommand() {
    return $this->commandShouldRun = true;
  }

  /**
   * Returns true if the command is runnable, false otherwise.
   *
   * @return bool
   */
  public function commandShouldRun() {
    return $this->commandShouldRun;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ConsoleCommandEvent::$commandShouldRun private property Indicates if the command should be run or skipped.
ConsoleCommandEvent::commandShouldRun public function Returns true if the command is runnable, false otherwise.
ConsoleCommandEvent::disableCommand public function Disables the command, so it won't be run.
ConsoleCommandEvent::enableCommand public function Enables the command.
ConsoleCommandEvent::RETURN_CODE_DISABLED constant The return code for skipped commands, this will also be passed into the terminate event.
ConsoleEvent::$command protected property
ConsoleEvent::$input private property
ConsoleEvent::$output private property
ConsoleEvent::getCommand public function Gets the command that is executed.
ConsoleEvent::getInput public function Gets the input instance.
ConsoleEvent::getOutput public function Gets the output instance.
ConsoleEvent::__construct public function 2
Event::$dispatcher private property
Event::$name private property
Event::$propagationStopped private property
Event::getDispatcher Deprecated public function Returns the EventDispatcher that dispatches this Event.
Event::getName Deprecated public function Gets the event's name.
Event::isPropagationStopped public function Returns whether further event listeners should be triggered.
Event::setDispatcher Deprecated public function Stores the EventDispatcher that dispatches this Event.
Event::setName Deprecated public function Sets the event's name property.
Event::stopPropagation public function Stops the propagation of the event to further event listeners.