Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 /*
|
Chris@0
|
4 * This file is part of the Symfony package.
|
Chris@0
|
5 *
|
Chris@0
|
6 * (c) Fabien Potencier <fabien@symfony.com>
|
Chris@0
|
7 *
|
Chris@0
|
8 * For the full copyright and license information, please view the LICENSE
|
Chris@0
|
9 * file that was distributed with this source code.
|
Chris@0
|
10 */
|
Chris@0
|
11
|
Chris@0
|
12 namespace Symfony\Component\Console\Event;
|
Chris@0
|
13
|
Chris@0
|
14 use Symfony\Component\Console\Command\Command;
|
Chris@0
|
15 use Symfony\Component\Console\Input\InputInterface;
|
Chris@0
|
16 use Symfony\Component\Console\Output\OutputInterface;
|
Chris@0
|
17 use Symfony\Component\EventDispatcher\Event;
|
Chris@0
|
18
|
Chris@0
|
19 /**
|
Chris@0
|
20 * Allows to inspect input and output of a command.
|
Chris@0
|
21 *
|
Chris@0
|
22 * @author Francesco Levorato <git@flevour.net>
|
Chris@0
|
23 */
|
Chris@0
|
24 class ConsoleEvent extends Event
|
Chris@0
|
25 {
|
Chris@0
|
26 protected $command;
|
Chris@0
|
27
|
Chris@0
|
28 private $input;
|
Chris@0
|
29 private $output;
|
Chris@0
|
30
|
Chris@14
|
31 public function __construct(Command $command = null, InputInterface $input, OutputInterface $output)
|
Chris@0
|
32 {
|
Chris@0
|
33 $this->command = $command;
|
Chris@0
|
34 $this->input = $input;
|
Chris@0
|
35 $this->output = $output;
|
Chris@0
|
36 }
|
Chris@0
|
37
|
Chris@0
|
38 /**
|
Chris@0
|
39 * Gets the command that is executed.
|
Chris@0
|
40 *
|
Chris@14
|
41 * @return Command|null A Command instance
|
Chris@0
|
42 */
|
Chris@0
|
43 public function getCommand()
|
Chris@0
|
44 {
|
Chris@0
|
45 return $this->command;
|
Chris@0
|
46 }
|
Chris@0
|
47
|
Chris@0
|
48 /**
|
Chris@0
|
49 * Gets the input instance.
|
Chris@0
|
50 *
|
Chris@0
|
51 * @return InputInterface An InputInterface instance
|
Chris@0
|
52 */
|
Chris@0
|
53 public function getInput()
|
Chris@0
|
54 {
|
Chris@0
|
55 return $this->input;
|
Chris@0
|
56 }
|
Chris@0
|
57
|
Chris@0
|
58 /**
|
Chris@0
|
59 * Gets the output instance.
|
Chris@0
|
60 *
|
Chris@0
|
61 * @return OutputInterface An OutputInterface instance
|
Chris@0
|
62 */
|
Chris@0
|
63 public function getOutput()
|
Chris@0
|
64 {
|
Chris@0
|
65 return $this->output;
|
Chris@0
|
66 }
|
Chris@0
|
67 }
|