/** {@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;
 }
Beispiel #2
0
 private function parseRuleElement(DOMElement $ruleElement)
 {
     $rule = new Rule();
     $rule->setName($ruleElement->getAttribute('name'));
     $rule->setCondition($this->parseCondition($ruleElement));
     $actionElements = $this->xpath->query('r:action', $ruleElement);
     foreach ($actionElements as $actionElement) {
         $this->parseActionElement($actionElement, $rule);
     }
     $subruleElements = $this->xpath->query('r:rule', $ruleElement);
     foreach ($subruleElements as $ruleElement) {
         $rule->appendRule($this->parseRuleElement($ruleElement));
     }
     return $rule;
 }
 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;
 }