/** * 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)); } }
/** * @param AbstractNode|AbstractASTArtifact $node * * @return float */ private function calculateNameToCommentSimilarityInPercent($node) { $docComment = $node->getDocComment(); if (empty($docComment)) { return 0; } similar_text($this->transformString($node->getName()), $this->getCommentDescription($docComment), $percent); return round($percent); }
/** * Generates an identifier for the given source item. * * @param \PDepend\Source\AST\AbstractASTArtifact $artifact * @param string $prefix The item type identifier. * @return string */ protected function forOffsetItem(AbstractASTArtifact $artifact, $prefix) { $fileHash = $artifact->getCompilationUnit()->getId(); $itemHash = $this->hash($prefix . ':' . strtolower($artifact->getName())); $offset = $this->getOffsetInFile($fileHash, $itemHash); return sprintf('%s-%s-%s', $fileHash, $itemHash, $offset); }
public function endVisitNode(AbstractASTArtifact $node) { $this->nodes[$node->getName() . '#end'] = true; parent::endVisitNode($node); }