1 | <?php |
||
11 | abstract class Command extends SymfonyCommand |
||
12 | { |
||
13 | /** |
||
14 | * Symfony console output. |
||
15 | * |
||
16 | * @var SymfonyOutput |
||
17 | */ |
||
18 | protected $output; |
||
19 | |||
20 | /** |
||
21 | * Symfony input implementation. |
||
22 | * |
||
23 | * @var InputInterface |
||
24 | */ |
||
25 | protected $input; |
||
26 | |||
27 | /** |
||
28 | * The command description. |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $description; |
||
33 | |||
34 | /** |
||
35 | * Configure the command if signature is set. |
||
36 | */ |
||
37 | protected function configure() |
||
47 | |||
48 | /** |
||
49 | * Execute the command. |
||
50 | * |
||
51 | * @param InputInterface $input |
||
52 | * @param OutputInterface $output |
||
53 | */ |
||
54 | protected function execute(InputInterface $input, OutputInterface $output) |
||
64 | |||
65 | /** |
||
66 | * Return the output implementation. |
||
67 | * |
||
68 | * @return SymfonyOutput |
||
69 | */ |
||
70 | protected function getOutput() |
||
74 | |||
75 | /** |
||
76 | * Get the value of a command argument. |
||
77 | * |
||
78 | * @param string $key |
||
79 | * |
||
80 | * @return string|array |
||
81 | */ |
||
82 | protected function argument($key = null) |
||
90 | |||
91 | /** |
||
92 | * Determine if the given argument is present. |
||
93 | * |
||
94 | * @param string|int $name |
||
95 | * |
||
96 | * @return bool |
||
97 | */ |
||
98 | protected function hasArgument($name) |
||
102 | |||
103 | /** |
||
104 | * Get the value of a command option. |
||
105 | * |
||
106 | * @param string $key |
||
107 | * |
||
108 | * @return string|array |
||
109 | */ |
||
110 | protected function option($key = null) |
||
118 | |||
119 | /** |
||
120 | * Determine if the given option is present. |
||
121 | * |
||
122 | * @param string $name |
||
123 | * |
||
124 | * @return bool |
||
125 | */ |
||
126 | protected function hasOption($name) |
||
130 | } |
||
131 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: