Exemplo n.º 1
0
 /** {@inheritdoc} */
 public function parse(\DOMElement $actionElement, Rule $rule, \DOMXPath $xpath)
 {
     $action = new FilterContext();
     if ($actionElement->hasAttribute('allow-keys')) {
         $keys = $actionElement->getAttribute('allow-keys');
         $action->setMode(FilterContext::ALLOW_KEYS);
     } else {
         $keys = $actionElement->getAttribute('disallow-keys');
         $action->setMode(FilterContext::DISALLOW_KEYS);
     }
     $action->setKeys(array_filter(preg_split('/\\s+/', $keys)));
     $rule->appendAction($action, $actionElement->getAttribute('stage'));
     return $action;
 }
Exemplo n.º 2
0
 public function parse(\DOMElement $actionElement, Rule $rule, \DOMXPath $xpath)
 {
     $context = new Context();
     $attributes = $xpath->query('attribute::*[name() = local-name()]', $actionElement);
     foreach ($attributes as $attribute) {
         $context[$attribute->nodeName] = $attribute->textContent;
     }
     $nodes = $xpath->query('child::*[name() = local-name()]', $actionElement);
     foreach ($nodes as $node) {
         $key = $node->nodeName;
         $value = $this->parseNodeValue($node, $xpath);
         if (isset($context[$node->nodeName])) {
             $context[$key] = array_merge_recursive((array) $context[$key], (array) $value);
         } else {
             $context[$key] = $value;
         }
     }
     $action = new OverrideContext($context);
     $rule->appendAction($action, $actionElement->getAttribute('stage'));
     return $action;
 }
 public function parse(\DOMElement $actionElement, Rule $rule, \DOMXPath $xpath)
 {
     $action = new InterpolateContext();
     $rule->appendAction($action, $actionElement->getAttribute('stage'));
     return $action;
 }