ConsoleEvent.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. public function __construct(
  23. protected ?Command $command,
  24. private InputInterface $input,
  25. private OutputInterface $output,
  26. ) {
  27. }
  28. /**
  29. * Gets the command that is executed.
  30. */
  31. public function getCommand(): ?Command
  32. {
  33. return $this->command;
  34. }
  35. /**
  36. * Gets the input instance.
  37. */
  38. public function getInput(): InputInterface
  39. {
  40. return $this->input;
  41. }
  42. /**
  43. * Gets the output instance.
  44. */
  45. public function getOutput(): OutputInterface
  46. {
  47. return $this->output;
  48. }
  49. }