/** * Generates an identifier for the given method instance. * * @param \PDepend\Source\AST\ASTMethod $method * @return string */ public function forMethod(ASTMethod $method) { return sprintf('%s-%s', $method->getParent()->getId(), $this->hash(strtolower($method->getName()))); }
/** * Visits a method node. * * @param \PDepend\Source\AST\ASTMethod $method * @return void */ public function visitMethod(ASTMethod $method) { $this->visits[] = $method->getName(); parent::visitMethod($method); }
/** * Visits a method node. * * @param \PDepend\Source\AST\ASTMethod $method * @return void */ public function visitMethod(ASTMethod $method) { $xml = end($this->xmlStack); $doc = $xml->ownerDocument; $methodXml = $doc->createElement('method'); $methodXml->setAttribute('name', $method->getName()); $this->writeNodeMetrics($methodXml, $method); $xml->appendChild($methodXml); }
/** * Returns an <b>array</b> with all aliases for the given method. If no * alias exists for the given method, this method will simply return the * an <b>array</b> with the original method. * * @param \PDepend\Source\AST\ASTMethod $method * @return \PDepend\Source\AST\ASTMethod[] */ private function getAliasesFor(ASTMethod $method) { $name = strtolower($method->getName()); $newNames = array(); foreach ($this->getAliases() as $alias) { $name2 = strtolower($alias->getImage()); if ($name2 !== $name) { continue; } $modifier = $method->getModifiers(); if (-1 < $alias->getNewModifier()) { $modifier &= ~(State::IS_PUBLIC | State::IS_PROTECTED | State::IS_PRIVATE); $modifier |= $alias->getNewModifier(); } $newName = $method->getName(); if ($alias->getNewName()) { $newName = $alias->getNewName(); } if (0 === count($alias->getChildren())) { $newMethod = clone $method; $newMethod->setName($newName); $newMethod->setModifiers($modifier); $newNames[] = $newMethod; continue; } if ($alias->getChild(0)->getType() !== $method->getParent()) { continue; } $newMethod = clone $method; $newMethod->setName($newName); $newMethod->setModifiers($modifier); $newNames[] = $newMethod; } if (count($newNames) > 0) { return $newNames; } return array($method); }
/** * Visits a method node. * * @param \PDepend\Source\AST\ASTMethod $method * @return void */ public function visitMethod(ASTMethod $method) { $xml = end($this->xmlStack); $doc = $xml->ownerDocument; $methodXml = $doc->createElement('method'); $methodXml->setAttribute('name', Utf8Util::ensureEncoding($method->getName())); $methodXml->setAttribute('start', Utf8Util::ensureEncoding($method->getStartLine())); $methodXml->setAttribute('end', Utf8Util::ensureEncoding($method->getEndLine())); $this->writeNodeMetrics($methodXml, $method); $xml->appendChild($methodXml); }