| Conditions | 7 |
| Paths | 22 |
| Total Lines | 70 |
| Code Lines | 44 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 62 | protected function execute(InputInterface $input, OutputInterface $output) |
||
| 63 | { |
||
| 64 | |||
| 65 | $io = new SymfonyStyle($input, $output); |
||
| 66 | |||
| 67 | $io->text("<fg=red>██████╗ ███████╗██████╗ ███╗ ███╗ ██████╗ ███╗ ██╗</>"); |
||
| 68 | $io->text("<fg=red>██╔══██╗██╔════╝██╔══██╗████╗ ████║██╔═══██╗████╗ ██║</>"); |
||
| 69 | $io->text("<fg=red>██║ ██║█████╗ ██████╔╝██╔████╔██║██║ ██║██╔██╗ ██║</>"); |
||
| 70 | $io->text("<fg=red>██║ ██║██╔══╝ ██╔═══╝ ██║╚██╔╝██║██║ ██║██║╚██╗██║</>"); |
||
| 71 | $io->text("<fg=red>██████╔╝███████╗██║ ██║ ╚═╝ ██║╚██████╔╝██║ ╚████║</>"); |
||
| 72 | $io->text("<fg=red>╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝</>"); |
||
| 73 | |||
| 74 | $io->title("Aggregate project data"); |
||
| 75 | |||
| 76 | // $projects = Yaml::parseFile('config/depmon.projects.yaml'); |
||
| 77 | $projects = $this->getContainer()->getParameter('xima_depmon.projects'); |
||
| 78 | |||
| 79 | $progressBar = new ProgressBar($output, count($projects)); |
||
| 80 | $progressBar->setFormat('verbose'); |
||
| 81 | |||
| 82 | $projectCount = count($projects); |
||
| 83 | $io->text("Fetching data for $projectCount projects ..."); |
||
| 84 | |||
| 85 | |||
| 86 | $dependencyCount = 0; |
||
| 87 | |||
| 88 | foreach ($projects as $project) { |
||
| 89 | try { |
||
| 90 | |||
| 91 | $data = $this->aggregator->fetchProjectData($project, $this->logger); |
||
| 92 | $count = count($data['dependencies']); |
||
| 93 | $requiredCount = $data['meta']['requiredPackagesCount']; |
||
| 94 | $requiredStatesCount = $data['meta']['requiredStatesCount']; |
||
| 95 | $dependencyCount += $count; |
||
| 96 | |||
| 97 | $this->cache->set($project['name'], $data); |
||
| 98 | |||
| 99 | switch ($data['meta']['projectState']) { |
||
| 100 | case 1: |
||
| 101 | $projectState = "<fg=green>up to date</>"; |
||
| 102 | break; |
||
| 103 | case 2: |
||
| 104 | $projectState = "<fg=yellow>up to date</>"; |
||
| 105 | break; |
||
| 106 | case 3: |
||
| 107 | default: |
||
| 108 | $projectState = "<fg=red>out of date</>"; |
||
| 109 | break; |
||
| 110 | case 4: |
||
| 111 | $projectState = "<fg=black>insecure</>"; |
||
| 112 | break; |
||
| 113 | } |
||
| 114 | |||
| 115 | $progressBar->advance(); |
||
| 116 | $output->writeln(" <fg=blue;options=bold>[" . $project['name'] . "]</> $count dependencies, $requiredCount required (<fg=green>$requiredStatesCount[1]</>, <fg=yellow>$requiredStatesCount[2]</>, <fg=red>$requiredStatesCount[3]</>, <fg=black>$requiredStatesCount[4]</>) ==> " . $projectState); |
||
| 117 | |||
| 118 | } catch (InvalidArgumentException $e) { |
||
| 119 | |||
| 120 | } |
||
| 121 | |||
| 122 | $this->aggregator->clearProjectData($project); |
||
| 123 | } |
||
| 124 | |||
| 125 | |||
| 126 | $metadata = [ |
||
| 127 | 'time' => time(), |
||
| 128 | 'dependencyCount' => $dependencyCount |
||
| 129 | ]; |
||
| 130 | |||
| 131 | $this->cache->set('metadata', $metadata); |
||
| 132 | } |
||
| 133 | } |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths