ConsoleEvent.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. use Symfony\Contracts\EventDispatcher\Event;
  15. /**
  16. * Allows to inspect input and output of a command.
  17. *
  18. * @author Francesco Levorato <git@flevour.net>
  19. */
  20. class ConsoleEvent extends Event
  21. {
  22. protected $command;
  23. private $input;
  24. private $output;
  25. public function __construct(?Command $command, InputInterface $input, OutputInterface $output)
  26. {
  27. $this->command = $command;
  28. $this->input = $input;
  29. $this->output = $output;
  30. }
  31. /**
  32. * Gets the command that is executed.
  33. *
  34. * @return Command|null
  35. */
  36. public function getCommand()
  37. {
  38. return $this->command;
  39. }
  40. /**
  41. * Gets the input instance.
  42. *
  43. * @return InputInterface
  44. */
  45. public function getInput()
  46. {
  47. return $this->input;
  48. }
  49. /**
  50. * Gets the output instance.
  51. *
  52. * @return OutputInterface
  53. */
  54. public function getOutput()
  55. {
  56. return $this->output;
  57. }
  58. }