コード例 #1
0
ファイル: DependencyAnalyzer.php プロジェクト: noelg/pdepend
 /**
  * Returns the statistics for the requested node.
  *
  * @param PHP_Depend_Code_NodeI $node The context node instance.
  *
  * @return array
  */
 public function getStats(PHP_Depend_Code_NodeI $node)
 {
     if (isset($this->stats[$node->getUUID()])) {
         return $this->stats[$node->getUUID()];
     }
     return array();
 }
コード例 #2
0
ファイル: Analyzer.php プロジェクト: kingsj/core
 /**
  * This method will return an <b>array</b> with all generated metric values
  * for the node with the given <b>$uuid</b> identifier. If there are no
  * metrics for the requested node, this method will return an empty <b>array</b>.
  *
  * <code>
  * array(
  *     'npath'  =>  '17'
  * )
  * </code>
  *
  * @param PHP_Depend_Code_NodeI $node The context node instance.
  *
  * @return array(string=>mixed)
  */
 public function getNodeMetrics(PHP_Depend_Code_NodeI $node)
 {
     $metric = array();
     if (isset($this->_metrics[$node->getUUID()])) {
         $metric = array(self::M_NPATH_COMPLEXITY => $this->_metrics[$node->getUUID()]);
     }
     return $metric;
 }
コード例 #3
0
ファイル: Analyzer.php プロジェクト: rouffj/pdepend
 /**
  * This method will return an <b>array</b> with all generated metric values
  * for the given <b>$node</b> instance. If there are no metrics for the
  * requested node, this method will return an empty <b>array</b>.
  *
  * @param PHP_Depend_Code_NodeI $node The context node instance.
  *
  * @return array(string=>mixed)
  */
 public function getNodeMetrics(PHP_Depend_Code_NodeI $node)
 {
     if (isset($this->_nodeMetrics[$node->getUUID()])) {
         return $this->_nodeMetrics[$node->getUUID()];
     }
     return array();
 }
コード例 #4
0
ファイル: PropertyStrategy.php プロジェクト: rouffj/pdepend
 /**
  * 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));
     }
 }
コード例 #5
0
ファイル: TestListener.php プロジェクト: noelg/pdepend
 public function endVisitNode(PHP_Depend_Code_NodeI $node)
 {
     $this->nodes[$node->getName() . '#end'] = true;
     parent::endVisitNode($node);
 }
コード例 #6
0
ファイル: Analyzer.php プロジェクト: KingNoosh/Teknik
 /**
  * Returns an array of nodes that build a cycle for the requested node or it
  * returns <b>null</b> if no cycle exists .
  *
  * @param PHP_Depend_Code_NodeI $node The context node instance.
  * @return PHP_Depend_Code_NodeI[]
  */
 public function getCycle(PHP_Depend_Code_NodeI $node)
 {
     if (array_key_exists($node->getUuid(), $this->collectedCycles)) {
         return $this->collectedCycles[$node->getUuid()];
     }
     $list = array();
     if ($this->collectCycle($list, $node)) {
         $this->collectedCycles[$node->getUuid()] = $list;
     } else {
         $this->collectedCycles[$node->getUuid()] = null;
     }
     return $this->collectedCycles[$node->getUuid()];
 }
コード例 #7
0
ファイル: Package.php プロジェクト: yusufchang/app
 /**
  * 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;
 }
コード例 #8
0
ファイル: Analyzer.php プロジェクト: KingNoosh/Teknik
 /**
  * This method will return an <b>array</b> with all generated metric values
  * for the given <b>$node</b> instance. If there are no metrics for the
  * requested node, this method will return an empty <b>array</b>.
  *
  * <code>
  * array(
  *     'loc'    =>  23,
  *     'cloc'   =>  17,
  *     'eloc'   =>  17,
  *     'ncloc'  =>  42
  * )
  * </code>
  *
  * @param PHP_Depend_Code_NodeI $node The context node instance.
  *
  * @return array
  */
 public function getNodeMetrics(PHP_Depend_Code_NodeI $node)
 {
     $metrics = array();
     if (isset($this->metrics[$node->getUuid()])) {
         $metrics = $this->metrics[$node->getUuid()];
     }
     return $metrics;
 }
コード例 #9
0
ファイル: Analyzer.php プロジェクト: noelg/pdepend
 /**
  * Returns an array of nodes that build a cycle for the requested node or it
  * returns <b>null</b> if no cycle exists .
  *
  * @param PHP_Depend_Code_NodeI $node The context node instance.
  *
  * @return array(PHP_Depend_Code_NodeI)
  */
 public function getCycle(PHP_Depend_Code_NodeI $node)
 {
     if (isset($this->_collectedCycles[$node->getUUID()])) {
         return $this->_collectedCycles[$node->getUUID()];
     }
     return null;
 }
コード例 #10
0
 /**
  * Tries to restore the metrics for a cached node. If this method has
  * restored the metrics it will return <b>TRUE</b>, otherwise the return
  * value will be <b>FALSE</b>.
  *
  * @param PHP_Depend_Code_NodeI $node The context node instance.
  *
  * @return boolean
  */
 protected function restoreFromCache(PHP_Depend_Code_NodeI $node)
 {
     $uuid = $node->getUUID();
     if ($node->isCached() && isset($this->_metricsCached[$uuid])) {
         $this->metrics[$uuid] = $this->_metricsCached[$uuid];
         return true;
     }
     return false;
 }