Conditions | 3 |
Paths | 3 |
Total Lines | 24 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
34 | public function printData(OutputInterface $output) |
||
35 | { |
||
36 | $separator = str_repeat('-', self::LINE_LENGTH); |
||
37 | $output->writeln(PHP_EOL . $separator . PHP_EOL); |
||
38 | |||
39 | $total = 0; |
||
40 | foreach ($this->fileReports as $fileReport) { |
||
41 | $entries = $fileReport->getEntries(); |
||
42 | $total += count($entries); |
||
43 | foreach ($entries as $entry) { |
||
44 | $output->writeln(sprintf( |
||
45 | '%s:%d. Magic number: %s', |
||
46 | $fileReport->getFile()->getRelativePathname(), |
||
47 | $entry['line'], |
||
48 | $entry['value'] |
||
49 | )); |
||
50 | |||
51 | $highlighter = new Highlighter(new ConsoleColor()); |
||
52 | $output->writeln($highlighter->getCodeSnippet($fileReport->getFile()->getContents(), $entry['line'], 0, 0)); |
||
53 | } |
||
54 | $output->writeln($separator . PHP_EOL); |
||
55 | } |
||
56 | $output->writeln('<info>Total of Magic Numbers: ' . $total . '</info>'); |
||
57 | } |
||
58 | } |
||
59 |