Conditions | 5 |
Paths | 4 |
Total Lines | 25 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
28 | public function inLoop(PluginArgument $arg) |
||
29 | { |
||
30 | $spec = $arg->getSpec(); |
||
31 | if (!array_key_exists('value', $spec) || null === $spec['value']) { |
||
32 | return; |
||
33 | } |
||
34 | |||
35 | $node = $arg->getNode(); |
||
36 | if (!($node instanceof DOMNode)) { |
||
37 | throw new Exception\LogicException('Expected node of type ' . DOMNode::class); |
||
38 | } |
||
39 | |||
40 | $varTranslation = $arg->getVarTranslation(); |
||
41 | $translatedValue = $arg->getHelper()->translateValue($spec['value'], $varTranslation, $spec); |
||
42 | $escapeHtml = $this->getEscapeHtml(); |
||
43 | $node->nodeValue = $escapeHtml->__invoke($varTranslation->removeVars($translatedValue)); |
||
44 | |||
45 | $varKey = $varTranslation->makeVar($varTranslation->makeExtraVarKey($node::NODE_VALUE_PROPERTY)); |
||
46 | $varTranslation->offsetSet($varKey, $node->nodeValue); |
||
47 | |||
48 | ($node instanceof Element) |
||
49 | and $varTranslation->merge( |
||
50 | $this->createNodeHtmlTranslation($node, $spec)->getVarTranslation()->getArrayCopy() |
||
51 | ); |
||
52 | } |
||
53 | } |
||
54 |