| Conditions | 2 |
| Paths | 2 |
| Total Lines | 22 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | protected function diff(string $text1, string $text2) { |
||
| 28 | |||
| 29 | $document = new \DOMDocument(); |
||
| 30 | $document->loadXML($text1); |
||
| 31 | |||
| 32 | $document2 = new \DOMDocument(); |
||
| 33 | $document2->loadXML($text2); |
||
| 34 | |||
| 35 | |||
| 36 | $xml1 = XmlConvertibleObject::fromXml($document); |
||
| 37 | $xml2 = XmlConvertibleObject::fromXml($document2); |
||
| 38 | |||
| 39 | $diff = $xml1->xmlDiff($xml2); |
||
| 40 | if(!$diff) { |
||
| 41 | return null; |
||
| 42 | } |
||
| 43 | |||
| 44 | $result = new \DOMDocument(); |
||
| 45 | $diffElement = $diff->toXml($result); |
||
| 46 | $result->appendChild($diffElement); |
||
| 47 | return $result->saveXML(); |
||
| 48 | } |
||
| 49 | |||
| 82 | } |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.