コード例 #1
0
ファイル: SiblingPolicy.php プロジェクト: fakeller/archinspec
 /**
  * {@inheritdoc}
  */
 public function isAllowed(NodeInterface $from, NodeInterface $to)
 {
     if ($this->isSibling($from, $to)) {
         return EvaluationResult::allowed($this);
     }
     return EvaluationResult::undefined();
 }
コード例 #2
0
ファイル: AllowPolicy.php プロジェクト: fakeller/archinspec
 /**
  * {@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();
 }
コード例 #3
0
ファイル: SymfonyPolicy.php プロジェクト: fakeller/archinspec
 /**
  * {@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();
 }