public function enterNode(Node $node) { parent::enterNode($node); if ($node instanceof Class_) { $this->currentClass = (string) $node->namespacedName; } if ($node instanceof ClassMethod) { $methodName = $this->currentClass . ($node->isStatic() ? '::' : '->') . $node->name; $this->currentMethod[] = $methodName; } if ($node instanceof Function_) { $this->currentMethod[] = (string) $node->namespacedName; } if ($node instanceof FuncCall) { if ($this->isTombstoneFunction($node)) { $line = $node->getLine(); $methodName = $this->getCurrentMethodName(); $params = $this->extractParameters($node); $date = isset($params[0]) ? $params[0] : null; $author = isset($params[1]) ? $params[1] : null; $label = isset($params[2]) ? $params[2] : null; $tombstone = new Tombstone($date, $author, $label, $this->file, $line, $methodName); $this->tombstoneIndex->addTombstone($tombstone); } } }
/** * @param Vampire $vampire * @param TombstoneIndex $tombstoneIndex * * @return Tombstone|null */ public function matchVampireToTombstone(Vampire $vampire, TombstoneIndex $tombstoneIndex) { if ($matchingTombstone = $tombstoneIndex->getInFileAndLine($vampire->getFile(), $vampire->getLine())) { if ($vampire->inscriptionEquals($matchingTombstone)) { return $matchingTombstone; } } return null; }
/** * @param Vampire $vampire * @param TombstoneIndex $tombstoneIndex * * @return Tombstone|null */ public function matchVampireToTombstone(Vampire $vampire, TombstoneIndex $tombstoneIndex) { if ($matchingTombstones = $tombstoneIndex->getInMethod($vampire->getMethod())) { foreach ($matchingTombstones as $matchingTombstone) { if ($vampire->inscriptionEquals($matchingTombstone)) { return $matchingTombstone; } } } return null; }