Chris@0: Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: namespace Symfony\Component\Console\Event; Chris@0: Chris@0: /** Chris@0: * Allows to do things before the command is executed, like skipping the command or changing the input. Chris@0: * Chris@0: * @author Fabien Potencier Chris@0: */ Chris@0: class ConsoleCommandEvent extends ConsoleEvent Chris@0: { Chris@0: /** Chris@0: * The return code for skipped commands, this will also be passed into the terminate event. Chris@0: */ Chris@0: const RETURN_CODE_DISABLED = 113; Chris@0: Chris@0: /** Chris@0: * Indicates if the command should be run or skipped. Chris@0: */ Chris@0: private $commandShouldRun = true; Chris@0: Chris@0: /** Chris@0: * Disables the command, so it won't be run. Chris@0: * Chris@0: * @return bool Chris@0: */ Chris@0: public function disableCommand() Chris@0: { Chris@0: return $this->commandShouldRun = false; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Enables the command. Chris@0: * Chris@0: * @return bool Chris@0: */ Chris@0: public function enableCommand() Chris@0: { Chris@0: return $this->commandShouldRun = true; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Returns true if the command is runnable, false otherwise. Chris@0: * Chris@0: * @return bool Chris@0: */ Chris@0: public function commandShouldRun() Chris@0: { Chris@0: return $this->commandShouldRun; Chris@0: } Chris@0: }