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