| Conditions | 6 |
| Paths | 4 |
| Total Lines | 17 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 42 |
| Changes | 0 | ||
| 1 | <?php |
||
| 45 | public function parse(string $filename): array |
||
| 46 | { |
||
| 47 | if ($this->checkFile($filename) |
||
| 48 | || ($handle = fopen(('.gz' == substr($filename, -3) ? 'compress.zlib://' : '').$filename, 'r')) === false) { |
||
| 49 | throw new \Exception('A problem occured with file `'.$filename.'`'); |
||
| 50 | } |
||
| 51 | |||
| 52 | $lineCounter = 1; |
||
| 53 | while (!feof($handle)) { |
||
| 54 | $line = fgets($handle); |
||
| 55 | $line = $line ? $this->parser->parse($line) : null; |
||
| 56 | $this->record($line, $lineCounter); |
||
| 57 | ++$lineCounter; |
||
| 58 | } |
||
| 59 | fclose($handle); |
||
| 60 | |||
| 61 | return $this->logs; |
||
| 62 | } |
||
| 71 |