ConsoleEvent.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. /**
  24. * @var \Symfony\Component\Console\Input\InputInterface
  25. */
  26. private $input;
  27. /**
  28. * @var \Symfony\Component\Console\Output\OutputInterface
  29. */
  30. private $output;
  31. /**
  32. * @param \Symfony\Component\Console\Command\Command|null $command
  33. * @param \Symfony\Component\Console\Input\InputInterface $input
  34. * @param \Symfony\Component\Console\Output\OutputInterface $output
  35. */
  36. public function __construct($command, $input, $output)
  37. {
  38. $this->command = $command;
  39. $this->input = $input;
  40. $this->output = $output;
  41. }
  42. /**
  43. * Gets the command that is executed.
  44. */
  45. public function getCommand()
  46. {
  47. return $this->command;
  48. }
  49. /**
  50. * Gets the input instance.
  51. */
  52. public function getInput()
  53. {
  54. return $this->input;
  55. }
  56. /**
  57. * Gets the output instance.
  58. */
  59. public function getOutput()
  60. {
  61. return $this->output;
  62. }
  63. }