Conditions | 5 |
Paths | 5 |
Total Lines | 18 |
Code Lines | 11 |
Lines | 18 |
Ratio | 100 % |
Changes | 0 |
1 | <?php |
||
30 | View Code Duplication | private function loadConsolesFromContainers() |
|
31 | { |
||
32 | $consoleClasses = []; |
||
33 | foreach (PortButler::getContainersNames() as $containerName) { |
||
34 | $containerCommandsDirectory = base_path('app/Containers/' . $containerName . '/UI/CLI/Commands/'); |
||
35 | if (File::isDirectory($containerCommandsDirectory)) { |
||
36 | $files = File::allFiles($containerCommandsDirectory); |
||
37 | foreach ($files as $consoleFile) { |
||
38 | if (File::isFile($consoleFile)) { |
||
39 | $pathName = $consoleFile->getPathname(); |
||
40 | $consoleClasses[] = PortButler::getClassFullNameFromFile($pathName); |
||
41 | } |
||
42 | } |
||
43 | } |
||
44 | }; |
||
45 | |||
46 | $this->loadConsoles($consoleClasses); |
||
47 | } |
||
48 | |||
68 |
PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.
Let’s take a look at an example:
If we look at the
getEmail()
method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:On the hand, if we look at the
setEmail()
, this method _has_ side-effects. In the following case, we could not remove the method call: