| Conditions | 4 | 
| Paths | 5 | 
| Total Lines | 26 | 
| Code Lines | 13 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 13 | 
| CRAP Score | 4 | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 27 | 12 | public function parse($path)  | 
            |
| 28 |     { | 
            ||
| 29 | // Require the file, if it throws an exception, rethrow it  | 
            ||
| 30 |         try { | 
            ||
| 31 | 12 | $temp = require $path;  | 
            |
| 32 | 12 |         } catch (Exception $exception) { | 
            |
| 33 | 3 | throw new ParseException(  | 
            |
| 34 | array(  | 
            ||
| 35 | 3 | 'message' => 'PHP file threw an exception',  | 
            |
| 36 | 3 | 'exception' => $exception,  | 
            |
| 37 | )  | 
            ||
| 38 | 3 | );  | 
            |
| 39 | }  | 
            ||
| 40 | |||
| 41 | // If we have a callable, run it and expect an array back  | 
            ||
| 42 | 9 |         if (is_callable($temp)) { | 
            |
| 43 | 3 | $temp = call_user_func($temp);  | 
            |
| 44 | 3 | }  | 
            |
| 45 | |||
| 46 | // Check for array, if its anything else, throw an exception  | 
            ||
| 47 | 9 |         if (!is_array($temp)) { | 
            |
| 48 | 3 |             throw new UnsupportedFormatException('PHP file does not return an array'); | 
            |
| 49 | }  | 
            ||
| 50 | |||
| 51 | 6 | return $temp;  | 
            |
| 52 | }  | 
            ||
| 53 | |||
| 62 |