/** * Returns an array of nodes that build a cycle for the requested node or it * returns <b>null</b> if no cycle exists . * * @param \PDepend\Source\AST\AbstractASTArtifact $node * @return \PDepend\Source\AST\AbstractASTArtifact[] */ public function getCycle(AbstractASTArtifact $node) { if (array_key_exists($node->getId(), $this->collectedCycles)) { return $this->collectedCycles[$node->getId()]; } $list = array(); if ($this->collectCycle($list, $node)) { $this->collectedCycles[$node->getId()] = $list; } else { $this->collectedCycles[$node->getId()] = null; } return $this->collectedCycles[$node->getId()]; }
/** * Initializes the temporary node container for the given <b>$node</b>. * * @param \PDepend\Source\AST\AbstractASTArtifact $node * @return void */ protected function initNode(AbstractASTArtifact $node) { if (!isset($this->nodes[$node->getId()])) { $this->nodes[$node->getId()] = array('in' => array(), 'out' => array(), 'name' => $node->getName(), 'type' => get_class($node)); } }
/** * 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 \PDepend\Source\AST\AbstractASTArtifact $node * @return boolean */ protected function restoreFromCache(AbstractASTArtifact $node) { $id = $node->getId(); if ($node->isCached() && isset($this->metricsCached[$id])) { $this->metrics[$id] = $this->metricsCached[$id]; return true; } return false; }
/** * Adds a source item that was parsed from this source file. * * @param \PDepend\Source\AST\AbstractASTArtifact $artifact * @return void * @since 0.10.0 */ public function addChild(AbstractASTArtifact $artifact) { $this->childNodes[$artifact->getId()] = $artifact; }
/** * Returns an array of all efferent nodes. * * @param \PDepend\Source\AST\AbstractASTArtifact $node * @return \PDepend\Source\AST\AbstractASTArtifact[] */ public function getEfferents(AbstractASTArtifact $node) { $efferents = array(); if (isset($this->efferentNodes[$node->getId()])) { $efferents = $this->efferentNodes[$node->getId()]; } return $efferents; }