| Conditions | 1 |
| Paths | 1 |
| Total Lines | 15 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | protected function addPreference(string $xmlFile, array $addition) |
||
| 30 | { |
||
| 31 | $content = file_get_contents($xmlFile); |
||
| 32 | $xmlArray = new \SimpleXMLElement($content); |
||
| 33 | |||
| 34 | $newRoute = $xmlArray->addChild('preference'); |
||
| 35 | $newRoute->addAttribute('for', $addition['for']); |
||
| 36 | $newRoute->addAttribute('type', $addition['type']); |
||
| 37 | |||
| 38 | $dom = new \DOMDocument("1.0"); |
||
| 39 | $dom->preserveWhiteSpace = false; |
||
| 40 | $dom->formatOutput = true; |
||
| 41 | $dom->loadXML($xmlArray->asXML()); |
||
| 42 | $xmlArray = new \SimpleXMLElement($dom->saveXML()); |
||
| 43 | $xmlArray->asXML($xmlFile); |
||
| 44 | } |
||
| 46 |