Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | 46 | public function parse(string $filePath): SimpleXMLElement |
|
19 | { |
||
20 | 46 | if (! file_exists($filePath)) { |
|
21 | 2 | throw new Exception("XML file not found: {$filePath}"); |
|
22 | } |
||
23 | |||
24 | 44 | $xml = @simplexml_load_file($filePath); |
|
25 | 44 | if ($xml === false) { |
|
26 | 2 | throw new Exception("Failed to load XML file: {$filePath}"); |
|
27 | } |
||
28 | |||
29 | 43 | return $xml; |
|
30 | } |
||
48 |