本文整理汇总了PHP中PHP_PMD_AbstractNode::getParentName方法的典型用法代码示例。如果您正苦于以下问题:PHP PHP_PMD_AbstractNode::getParentName方法的具体用法?PHP PHP_PMD_AbstractNode::getParentName怎么用?PHP PHP_PMD_AbstractNode::getParentName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHP_PMD_AbstractNode
的用法示例。
在下文中一共展示了PHP_PMD_AbstractNode::getParentName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: apply
/**
* Extracts all variable and variable declarator nodes from the given node
* and checks the variable name length against the configured minimum
* length.
*
* @param PHP_PMD_AbstractNode $node The context source code node.
*
* @return void
*/
public function apply(PHP_PMD_AbstractNode $node)
{
if (strcasecmp($node->getName(), $node->getParentName()) !== 0) {
return;
}
$this->addViolation($node);
}
示例2: __construct
/**
* Constructs a new rule violation instance.
*
* @param PHP_PMD_AbstractRule $rule PHP_PMD rule for violation.
* @param PHP_PMD_AbstractNode $node The source node of evil.
* @param string $violationMessage The error/report message.
*/
public function __construct(PHP_PMD_AbstractRule $rule, PHP_PMD_AbstractNode $node, $violationMessage)
{
$this->_rule = $rule;
$this->_node = $node;
$this->_description = $violationMessage;
if ($node instanceof PHP_PMD_Node_AbstractType) {
$this->_className = $node->getName();
} else {
if ($node instanceof PHP_PMD_Node_Method) {
$this->_className = $node->getParentName();
$this->_CodeMethodName = $node->getName();
} else {
if ($node instanceof PHP_PMD_Node_Function) {
$this->_functionName = $node->getName();
}
}
}
}