Beispiel #1
0
 /**
  * Initializes the temporary node container for the given <b>$node</b>.
  *
  * @param PHP_Depend_Code_NodeI $node The context node instance.
  *
  * @return void
  */
 protected function initNode(PHP_Depend_Code_NodeI $node)
 {
     if (!isset($this->_nodes[$node->getUUID()])) {
         $this->_nodes[$node->getUUID()] = array('in' => array(), 'out' => array(), 'name' => $node->getName(), 'type' => get_class($node));
     }
 }
Beispiel #2
0
 /**
  * Returns the node metrics.
  *
  * @param PHP_Depend_Code_NodeI $node context npde.
  * 
  * @return array
  */
 public function getNodeMetrics(PHP_Depend_Code_NodeI $node)
 {
     if (isset($this->nodeMetrics[$node->getName()])) {
         return $this->nodeMetrics[$node->getName()];
     }
     return array();
 }
Beispiel #3
0
 public function endVisitNode(PHP_Depend_Code_NodeI $node)
 {
     $this->nodes[$node->getName() . '#end'] = true;
     parent::endVisitNode($node);
 }
Beispiel #4
0
 /**
  * Returns <b>true</b> if the given node should be part of the node iterator,
  * otherwise this method will return <b>false</b>.
  *
  * @param PHP_Depend_Code_NodeI $node The context node instance.
  *
  * @return boolean
  */
 public function accept(PHP_Depend_Code_NodeI $node)
 {
     $package = null;
     // NOTE: This looks a little bit ugly and it seems better to exclude
     //       PHP_Depend_Code_Method and PHP_Depend_Code_Property, but when
     //       PDepend supports more node types, this could produce errors.
     if ($node instanceof PHP_Depend_Code_AbstractClassOrInterface) {
         $package = $node->getPackage()->getName();
     } else {
         if ($node instanceof PHP_Depend_Code_Function) {
             $package = $node->getPackage()->getName();
         } else {
             if ($node instanceof PHP_Depend_Code_Package) {
                 $package = $node->getName();
             }
         }
     }
     return preg_match($this->_pattern, $package) === 0;
 }