| Conditions | 2 |
| Paths | 2 |
| Total Lines | 19 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | 7 | public function getArrayFromXml($xml): array |
|
| 21 | 7 | { |
|
| 22 | 7 | $xmlParser = xml_parser_create(); |
|
| 23 | xml_set_object($xmlParser, $this); |
||
| 24 | 7 | xml_set_element_handler($xmlParser, "tagOpen", "tagClosed"); |
|
| 25 | xml_set_character_data_handler($xmlParser, "tagData"); |
||
| 26 | 7 | ||
| 27 | 2 | $successfulParse = xml_parse($xmlParser, $xml, true); |
|
| 28 | 2 | ||
| 29 | if ($successfulParse === 0) { |
||
| 30 | 2 | $errorString = xml_error_string(xml_get_error_code($xmlParser)); |
|
| 31 | $errorLine = xml_get_current_line_number($xmlParser); |
||
| 32 | |||
| 33 | 5 | throw new XmlParseException("Error parsing XML: {$errorString} at line {$errorLine}."); |
|
| 34 | } |
||
| 35 | 5 | ||
| 36 | xml_parser_free($xmlParser); |
||
| 37 | |||
| 38 | 5 | return $this->output; |
|
| 39 | } |
||
| 68 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.