You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.0 KiB

3 years ago
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Console\Event;
  11. use Symfony\Component\Console\Command\Command;
  12. use Symfony\Component\Console\Input\InputInterface;
  13. use Symfony\Component\Console\Output\OutputInterface;
  14. /**
  15. * Allows to manipulate the exit code of a command after its execution.
  16. *
  17. * @author Francesco Levorato <git@flevour.net>
  18. */
  19. final class ConsoleTerminateEvent extends ConsoleEvent
  20. {
  21. private $exitCode;
  22. public function __construct(Command $command, InputInterface $input, OutputInterface $output, int $exitCode)
  23. {
  24. parent::__construct($command, $input, $output);
  25. $this->setExitCode($exitCode);
  26. }
  27. public function setExitCode(int $exitCode): void
  28. {
  29. $this->exitCode = $exitCode;
  30. }
  31. public function getExitCode(): int
  32. {
  33. return $this->exitCode;
  34. }
  35. }