예제 #1
0
 /**
  * Returns the source name for this node, maybe a class or interface name,
  * or a package, method, function name.
  *
  * @return string
  */
 public function getName()
 {
     return $this->node->getName();
 }
 /**
  * Returns <b>true</b> if the given node should be part of the node iterator,
  * otherwise this method will return <b>false</b>.
  *
  * @param \PDepend\Source\AST\ASTArtifact $node
  * @return boolean
  */
 public function accept(ASTArtifact $node)
 {
     $namespace = null;
     // NOTE: This looks a little bit ugly and it seems better to exclude
     //       \PDepend\Source\AST\ASTMethod and \PDepend\Source\AST\ASTProperty,
     //       but when PDepend supports more node types, this could produce errors.
     if ($node instanceof AbstractASTClassOrInterface) {
         $namespace = $node->getNamespace()->getName();
     } elseif ($node instanceof ASTFunction) {
         $namespace = $node->getNamespace()->getName();
     } elseif ($node instanceof ASTNamespace) {
         $namespace = $node->getName();
     }
     return preg_match($this->pattern, $namespace) === 0;
 }
 /**
  * Returns the node metrics.
  *
  * @param \PDepend\Source\AST\ASTArtifact $artifact
  * @return array
  */
 public function getNodeMetrics(ASTArtifact $artifact)
 {
     if (isset($this->nodeMetrics[$artifact->getName()])) {
         return $this->nodeMetrics[$artifact->getName()];
     }
     return array();
 }