| Conditions | 3 |
| Paths | 5 |
| Total Lines | 22 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 3.1707 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 26 | 4 | public function parse($filePath, $itemCallback, bool $assoc = true): void |
|
| 27 | { |
||
| 28 | 4 | $this->checkCallback($itemCallback); |
|
| 29 | |||
| 30 | 4 | $stream = $this->openFile($filePath); |
|
| 31 | |||
| 32 | try { |
||
| 33 | 4 | $listener = new Listener($itemCallback, $assoc); |
|
| 34 | 4 | $this->parser = new StreamingParser( |
|
| 35 | 4 | $stream, |
|
| 36 | 4 | $listener, |
|
| 37 | 4 | $this->getOption('line_ending'), |
|
|
|
|||
| 38 | 4 | $this->getOption('emit_whitespace') |
|
| 39 | ); |
||
| 40 | 4 | $this->parser->parse(); |
|
| 41 | } catch (\Exception $e) { |
||
| 42 | fclose($stream); |
||
| 43 | throw $e; |
||
| 44 | } |
||
| 45 | |||
| 46 | 4 | if( ! fclose($stream)){ |
|
| 47 | throw new IncompleteParseException(); |
||
| 48 | } |
||
| 67 |