1 | <?php |
||
13 | class InstallCommand extends Command |
||
14 | { |
||
15 | /** |
||
16 | * Avoids using llum to install package. |
||
17 | * |
||
18 | * @var bool |
||
19 | */ |
||
20 | protected $noLlum = false; |
||
21 | |||
22 | /** |
||
23 | * Install development version. |
||
24 | * |
||
25 | * @var bool |
||
26 | */ |
||
27 | protected $installDev = false; |
||
28 | |||
29 | /** |
||
30 | * Install using php artisan vendor:publish. |
||
31 | * |
||
32 | * @var bool |
||
33 | */ |
||
34 | protected $useVendorPublish = false; |
||
35 | |||
36 | /** |
||
37 | * Install asking before overwrite files. |
||
38 | * |
||
39 | * @var bool |
||
40 | */ |
||
41 | protected $askBeforeOverwrite = false; |
||
42 | |||
43 | /** |
||
44 | * Initialize command. |
||
45 | * |
||
46 | * @param InputInterface $input |
||
47 | * @param OutputInterface $output |
||
48 | */ |
||
49 | protected function initialize(InputInterface $input, OutputInterface $output) |
||
65 | |||
66 | /** |
||
67 | * Check is --no-llum option is active. |
||
68 | * |
||
69 | * @return bool |
||
70 | */ |
||
71 | private function isNoLlumActive() |
||
75 | |||
76 | /** |
||
77 | * Configure the command options. |
||
78 | */ |
||
79 | protected function configure() |
||
86 | |||
87 | /** |
||
88 | * Execute the command. |
||
89 | * |
||
90 | * @param InputInterface $input |
||
91 | * @param OutputInterface $output |
||
92 | */ |
||
93 | protected function execute(InputInterface $input, OutputInterface $output) |
||
104 | |||
105 | /** |
||
106 | * Get llum package name |
||
107 | */ |
||
108 | private function getPackageName() { |
||
114 | |||
115 | /** |
||
116 | * Execute command wiht option --no-llum. |
||
117 | * |
||
118 | * @param OutputInterface $output |
||
119 | */ |
||
120 | protected function executeWithoutLlum(OutputInterface $output) |
||
138 | |||
139 | /** |
||
140 | * Get the composer command for the environment. |
||
141 | * |
||
142 | * @return string |
||
143 | */ |
||
144 | private function findComposer() |
||
152 | |||
153 | /** |
||
154 | * Get the llum command for the environment. |
||
155 | * |
||
156 | * @return string |
||
157 | */ |
||
158 | private function findLlum() |
||
170 | |||
171 | /** |
||
172 | * Get the real path of a link or regular path if file is not a link. |
||
173 | * |
||
174 | * @param $file |
||
175 | * |
||
176 | * @return string |
||
177 | */ |
||
178 | private function getRealPath($file) |
||
186 | |||
187 | /** |
||
188 | * @return string |
||
189 | */ |
||
190 | public function getUserHomePath() |
||
202 | |||
203 | /* |
||
204 | * Gets dev option |
||
205 | * |
||
206 | * @return string |
||
207 | */ |
||
208 | /** |
||
209 | * @return string |
||
210 | */ |
||
211 | private function getDevOption() |
||
215 | |||
216 | /* |
||
217 | * Gets dev suffix |
||
218 | * |
||
219 | * @return string |
||
220 | */ |
||
221 | /** |
||
222 | * @return string |
||
223 | */ |
||
224 | private function getDevSuffix() |
||
228 | |||
229 | /** |
||
230 | * Manually publishes files to project. |
||
231 | * |
||
232 | * @param OutputInterface $output |
||
233 | */ |
||
234 | protected function publish(OutputInterface $output) |
||
239 | |||
240 | /** |
||
241 | * Publishes files with artisan publish command. |
||
242 | * |
||
243 | * @param OutputInterface $output |
||
244 | */ |
||
245 | protected function publishWithVendor(OutputInterface $output) |
||
250 | } |
||
251 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: