1 | <?php |
||
12 | class AddonNameCommand extends Command |
||
13 | { |
||
14 | /** |
||
15 | * The console command signature. |
||
16 | * |
||
17 | * @var string |
||
18 | */ |
||
19 | protected $signature = 'addon:name |
||
20 | {addon : The desired namespace.} |
||
21 | {namespace : The desired namespace.} |
||
22 | '; |
||
23 | |||
24 | /** |
||
25 | * The console command description. |
||
26 | * |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $description = 'Set the addon PHP namespace'; |
||
30 | |||
31 | /** |
||
32 | * @var \Illuminate\Filesystem\Filesystem |
||
33 | */ |
||
34 | protected $filesystem; |
||
35 | |||
36 | /** |
||
37 | * @var \Jumilla\Addomnipot\Laravel\Addons\Addon |
||
38 | */ |
||
39 | protected $addon; |
||
40 | |||
41 | /** |
||
42 | * @var string |
||
43 | */ |
||
44 | protected $currentNamespace; |
||
45 | |||
46 | /** |
||
47 | * @var string |
||
48 | */ |
||
49 | protected $newNamespace; |
||
50 | |||
51 | /** |
||
52 | * Execute the console command. |
||
53 | * |
||
54 | * @return mixed |
||
55 | */ |
||
56 | 2 | public function handle(Filesystem $filesystem, AddonEnvironment $env) |
|
82 | |||
83 | /** |
||
84 | * Set the namespace in addon.php, adon.json file. |
||
85 | */ |
||
86 | 1 | protected function setAddonNamespaces() |
|
91 | |||
92 | /** |
||
93 | * Set the namespace in addon.php file. |
||
94 | */ |
||
95 | 1 | protected function setAddonConfigNamespaces() |
|
117 | |||
118 | /** |
||
119 | * Set the namespace in addon.json file. |
||
120 | */ |
||
121 | 1 | protected function setAddonJsonNamespaces() |
|
142 | |||
143 | /** |
||
144 | * Set the PSR-4 namespace in the Composer file. |
||
145 | */ |
||
146 | 1 | protected function setComposerNamespace() |
|
154 | |||
155 | /** |
||
156 | * Set the namespace on the files in the class directory. |
||
157 | */ |
||
158 | 1 | protected function setClassNamespace() |
|
182 | |||
183 | /** |
||
184 | * Set the namespace in the appropriate configuration files. |
||
185 | */ |
||
186 | 1 | protected function setConfigNamespaces() |
|
200 | |||
201 | /** |
||
202 | * Replace the namespace in PHP configuration file. |
||
203 | * |
||
204 | * @param string $path |
||
205 | */ |
||
206 | protected function replaceConfigNamespaces($path) |
||
222 | |||
223 | /** |
||
224 | * Replace the given string in the given file. |
||
225 | * |
||
226 | * @param string $path |
||
227 | * @param string | array $search |
||
228 | * @param string | array $replace |
||
229 | */ |
||
230 | 1 | protected function replaceIn($path, $search, $replace) |
|
238 | } |
||
239 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.