1 | <?php |
||
18 | abstract class AbstractCommand |
||
19 | { |
||
20 | |||
21 | /** |
||
22 | * Application |
||
23 | * |
||
24 | * @var Application |
||
25 | */ |
||
26 | private $application; |
||
27 | |||
28 | /** |
||
29 | * Migrations command |
||
30 | * |
||
31 | * @var MigrationsCommand |
||
32 | */ |
||
33 | private $migrationsCommand; |
||
34 | |||
35 | /** |
||
36 | * Configuration |
||
37 | * |
||
38 | * @var Configuration |
||
39 | */ |
||
40 | private $configuration; |
||
41 | |||
42 | /** |
||
43 | * Output |
||
44 | * |
||
45 | * @var OutputInterface |
||
46 | */ |
||
47 | private $output; |
||
48 | |||
49 | /** |
||
50 | * Migrations config |
||
51 | * |
||
52 | * @var array |
||
53 | */ |
||
54 | private $migrationsConfig; |
||
55 | |||
56 | /** |
||
57 | * Constructor |
||
58 | * |
||
59 | * @param Application $application |
||
60 | * @param MigrationsCommand $migrationsCommand |
||
61 | * @param Configuration $configuration |
||
62 | * @param OutputInterface $output |
||
63 | * @param array $migrationsConfig |
||
64 | */ |
||
65 | public function __construct( |
||
75 | |||
76 | public function __invoke(Route $route, AdapterInterface $console) |
||
98 | |||
99 | /** |
||
100 | * Get input command |
||
101 | * |
||
102 | * @param Route $route |
||
103 | * @return string |
||
104 | */ |
||
105 | abstract public function getInputCommand(Route $route); |
||
106 | |||
107 | /** |
||
108 | * Apply boolean params |
||
109 | * |
||
110 | * @param array $params |
||
111 | * @param array $matches |
||
112 | * @return array |
||
113 | */ |
||
114 | protected function applyBooleanParams(array $params, array $matches) |
||
123 | |||
124 | /** |
||
125 | * Get application |
||
126 | * |
||
127 | * @return Application |
||
128 | */ |
||
129 | public function getApplication() |
||
133 | |||
134 | /** |
||
135 | * Get migrations command |
||
136 | * |
||
137 | * @return MigrationsCommand |
||
138 | */ |
||
139 | public function getMigrationsCommand() |
||
143 | |||
144 | /** |
||
145 | * Get configuration |
||
146 | * |
||
147 | * @return Configuration |
||
148 | */ |
||
149 | public function getConfiguration() |
||
153 | |||
154 | /** |
||
155 | * Get migrations config |
||
156 | * |
||
157 | * @return the array |
||
158 | */ |
||
159 | public function getMigrationsConfig() |
||
163 | |||
164 | /** |
||
165 | * Get output |
||
166 | * |
||
167 | * @return OutputInterface |
||
168 | */ |
||
169 | public function getOutput() |
||
173 | } |
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: