Example #1
0
 /**
  * {@inheritdoc}
  */
 public function isAllowed(NodeInterface $from, NodeInterface $to)
 {
     if ($this->isSibling($from, $to)) {
         return EvaluationResult::allowed($this);
     }
     return EvaluationResult::undefined();
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function isAllowed(NodeInterface $from, NodeInterface $to)
 {
     foreach ($this->getTargets() as $namespace) {
         if ($this->namespaceContains($namespace, $to->getFQName())) {
             return EvaluationResult::allowed($this);
         }
     }
     return EvaluationResult::undefined();
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 public function isAllowed(NodeInterface $from, NodeInterface $to)
 {
     foreach ($this->allow as $regex => $allowed) {
         // check that $from matches
         if (!$this->regexMatchesNode($regex, $from)) {
             continue;
         }
         // check all allowed namespaces
         foreach ($allowed as $namespace) {
             if ($this->namespaceContains($namespace, $to->getFQName())) {
                 return EvaluationResult::allowed($this);
             }
         }
     }
     return EvaluationResult::undefined();
 }