| Total Complexity | 2 |
| Total Lines | 31 |
| Duplicated Lines | 0 % |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | final class FragmentInjection implements XmlInjectable |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var string |
||
| 16 | */ |
||
| 17 | private $parentNS; |
||
| 18 | /** |
||
| 19 | * @var string |
||
| 20 | */ |
||
| 21 | private $parentTagName; |
||
| 22 | /** |
||
| 23 | * @var string |
||
| 24 | */ |
||
| 25 | private $fragment; |
||
| 26 | |||
| 27 | public function inject(DOMDocument $dom): void |
||
| 28 | { |
||
| 29 | $elements = $dom->getElementsByTagNameNS($this->parentNS, $this->parentTagName); |
||
| 30 | |||
| 31 | $fragment = $dom->createDocumentFragment(); |
||
| 32 | $fragment->appendXML($this->fragment); |
||
| 33 | |||
| 34 | $elements->item(0)->appendChild($fragment); |
||
| 35 | } |
||
| 36 | |||
| 37 | public function __construct(string $parentNS, string $parentTagName, string $fragment) |
||
| 43 | } |
||
| 44 | } |
||
| 45 |