| Conditions | 7 |
| Paths | 8 |
| Total Lines | 28 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | public function map(array $data): array |
||
| 32 | { |
||
| 33 | $mappedData = []; |
||
| 34 | |||
| 35 | foreach ($data as $file => $report) { |
||
| 36 | if (!isset($this->changedLinesPerFile[$file]) || !is_array($this->changedLinesPerFile[$file])) { |
||
| 37 | continue; |
||
| 38 | } |
||
| 39 | |||
| 40 | $changedLinesFromDiff = $this->changedLinesPerFile[$file]; |
||
| 41 | |||
| 42 | $output = []; |
||
| 43 | foreach ($report['messages'] as $message) { |
||
| 44 | if (!in_array($message['line'], $changedLinesFromDiff, true)) { |
||
| 45 | continue; |
||
| 46 | } |
||
| 47 | $output[] = ' - Line ' . $message['line'] . ' (' . $message['type'] . ') ' . $message['message']; |
||
| 48 | } |
||
| 49 | |||
| 50 | if (empty($output)) { |
||
| 51 | continue; |
||
| 52 | } |
||
| 53 | |||
| 54 | $mappedData[] = str_replace($this->currentDirectory . '/', '', $file) . PHP_EOL . |
||
| 55 | implode(PHP_EOL, $output) . PHP_EOL; |
||
| 56 | } |
||
| 57 | |||
| 58 | return $mappedData; |
||
| 59 | } |
||
| 61 |