暫無描述

ConsoleEvent.php 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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\Component\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 A Command instance
  35. */
  36. public function getCommand()
  37. {
  38. return $this->command;
  39. }
  40. /**
  41. * Gets the input instance.
  42. *
  43. * @return InputInterface An InputInterface instance
  44. */
  45. public function getInput()
  46. {
  47. return $this->input;
  48. }
  49. /**
  50. * Gets the output instance.
  51. *
  52. * @return OutputInterface An OutputInterface instance
  53. */
  54. public function getOutput()
  55. {
  56. return $this->output;
  57. }
  58. }