| Conditions | 5 |
| Paths | 4 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 38 | public function inLoop(PluginArgument $arg) |
||
| 39 | { |
||
| 40 | $spec = $arg->getSpec(); |
||
| 41 | if (!array_key_exists('cdata', $spec) || null === $spec['cdata']) { |
||
| 42 | return; |
||
| 43 | } |
||
| 44 | |||
| 45 | $node = $arg->getNode(); |
||
| 46 | if (!($node instanceof DOMElement)) { |
||
| 47 | throw new Exception\LogicException('Expected node of type DOMElement'); |
||
| 48 | } |
||
| 49 | |||
| 50 | $node->nodeValue = ''; |
||
| 51 | $translatedCdata = $arg->getHelper()->translateValue($spec['cdata'], $arg->getVarTranslation(), $spec); |
||
| 52 | if (empty($translatedCdata)) { |
||
| 53 | return; |
||
| 54 | } |
||
| 55 | |||
| 56 | $node->appendChild($node->ownerDocument->createCdataSection($translatedCdata)); |
||
| 57 | } |
||
| 58 | } |
||
| 59 |