| Conditions | 5 |
| Paths | 6 |
| Total Lines | 21 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | protected function inspectDependencyGraph(DependencyGraph $graph, OutputInterface $output): int |
||
| 24 | { |
||
| 25 | $response = (new CycleDetector())->inspect($graph); |
||
| 26 | |||
| 27 | $output->writeln("{$response->count()} cycles detected."); |
||
| 28 | $output->writeln(''); |
||
| 29 | |||
| 30 | foreach ($response->getCycles() as $cycle) { |
||
| 31 | $table = (new ConsoleTable()) |
||
| 32 | ->addHeader('class') |
||
| 33 | ->addHeader(''); |
||
| 34 | foreach ($cycle as $index => $class) { |
||
| 35 | $haveNextClass = (bool)($index < (count($cycle) - 1)); |
||
| 36 | $table->addRow([$class, $haveNextClass ? '->' : '']); |
||
| 37 | } |
||
| 38 | |||
| 39 | $output->write($table->getTable()); |
||
| 40 | $output->writeln(''); |
||
| 41 | } |
||
| 42 | |||
| 43 | return count($response) > 0 ? 1 : 0; |
||
| 44 | } |
||
| 46 |