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: use Symfony\Component\Console\Command\Command; Chris@0: use Symfony\Component\Console\Input\InputInterface; Chris@0: use Symfony\Component\Console\Output\OutputInterface; Chris@0: Chris@0: /** Chris@0: * Allows to manipulate the exit code of a command after its execution. Chris@0: * Chris@0: * @author Francesco Levorato Chris@0: */ Chris@0: class ConsoleTerminateEvent extends ConsoleEvent Chris@0: { Chris@0: /** Chris@0: * The exit code of the command. Chris@0: * Chris@0: * @var int Chris@0: */ Chris@0: private $exitCode; Chris@0: Chris@0: public function __construct(Command $command, InputInterface $input, OutputInterface $output, $exitCode) Chris@0: { Chris@0: parent::__construct($command, $input, $output); Chris@0: Chris@0: $this->setExitCode($exitCode); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Sets the exit code. Chris@0: * Chris@0: * @param int $exitCode The command exit code Chris@0: */ Chris@0: public function setExitCode($exitCode) Chris@0: { Chris@0: $this->exitCode = (int) $exitCode; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Gets the exit code. Chris@0: * Chris@0: * @return int The command exit code Chris@0: */ Chris@0: public function getExitCode() Chris@0: { Chris@0: return $this->exitCode; Chris@0: } Chris@0: }