Total Complexity | 7 |
Total Lines | 39 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php declare(strict_types = 1); |
||
12 | abstract class AbstractXMLResource |
||
13 | { |
||
14 | private ?XMLReader $xml = null; |
||
15 | |||
16 | public function __construct(private readonly string $path) |
||
17 | { |
||
18 | } |
||
19 | |||
20 | public function __destruct() |
||
21 | { |
||
22 | $this->closeXMLReader(); |
||
23 | } |
||
24 | |||
25 | protected function getXMLReader(): XMLReader |
||
28 | } |
||
29 | |||
30 | protected function createXMLReader(): XMLReader |
||
31 | { |
||
32 | return $this->validateXMLReader(xml: new XMLReader()); |
||
33 | } |
||
34 | |||
35 | protected function closeXMLReader(): void |
||
39 | } |
||
40 | |||
41 | private function validateXMLReader(XMLReader $xml): XMLReader |
||
42 | { |
||
53 |
If you suppress an error, we recommend checking for the error condition explicitly: