Conditions | 4 |
Paths | 3 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
20 | 18 | public function __construct($xmlFile) |
|
21 | { |
||
22 | 18 | if (!is_file($xmlFile) || !is_readable($xmlFile)) { |
|
23 | 3 | throw new InvalidArgumentException( |
|
24 | 3 | sprintf("Can't read file `%s`.", $xmlFile)); |
|
25 | } |
||
26 | |||
27 | 15 | $xml = @simplexml_load_file($xmlFile); |
|
28 | |||
29 | 15 | if (!$xml) { |
|
30 | 4 | throw new InvalidArgumentException( |
|
31 | 3 | sprintf("Invalid XML file `%s`.", $xmlFile)); |
|
32 | } |
||
33 | |||
34 | 12 | parent::__construct($xml); |
|
35 | 12 | } |
|
36 | } |
||
37 |