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