/** * Constructs a new collection instance. * * @param \PHPMD\AbstractNode $node */ public function __construct(\PHPMD\AbstractNode $node) { preg_match_all($this->regexp, $node->getDocComment(), $matches); foreach (array_keys($matches[0]) as $i) { $name = $matches[1][$i]; $value = trim($matches[2][$i], '" '); $this->annotations[] = new Annotation($name, $value); } }
/** * @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); }
/** * Returns <b>true</b> when the given node is method with signature declared as inherited using * {@inheritdoc} annotation. * * @param \PHPMD\AbstractNode $node * @return boolean */ private function isInheritedSignature(AbstractNode $node) { if ($node instanceof MethodNode) { return preg_match('/\\@inheritdoc/i', $node->getDocComment()); } return false; }