本文整理汇总了PHP中PHP_PMD_AbstractNode::getParent方法的典型用法代码示例。如果您正苦于以下问题:PHP PHP_PMD_AbstractNode::getParent方法的具体用法?PHP PHP_PMD_AbstractNode::getParent怎么用?PHP PHP_PMD_AbstractNode::getParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHP_PMD_AbstractNode
的用法示例。
在下文中一共展示了PHP_PMD_AbstractNode::getParent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _isNotStaticPostfix
/**
* This method will return <b>true</b> when the given variable node is
* not the child of a property postfix node.
*
* @param PHP_PMD_AbstractNode $variable The currently analyzed variable node.
*
* @return boolean
*/
private function _isNotStaticPostfix(PHP_PMD_AbstractNode $variable)
{
$parent = $variable->getParent();
if (is_object($parent) && $parent->isInstanceOf('PropertyPostfix')) {
return !($parent->getParent()->getImage() === '::');
}
return true;
}
示例2: isChildOf
/**
* Checks if the given node is a direct or indirect child of a node with
* the given type.
*
* @param PHP_PMD_AbstractNode $node The context source code node.
* @param string $type Possible parent type.
*
* @return boolean
*/
private function isChildOf(PHP_PMD_AbstractNode $node, $type)
{
$parent = $node->getParent();
while (is_object($parent)) {
if ($parent->isInstanceOf($type)) {
return true;
}
$parent = $parent->getParent();
}
return false;
}
示例3: _isChildOf
/**
* Checks if the given node is a direct or indirect child of a node with
* the given type.
*
* @param PHP_PMD_AbstractNode $node The context source code node.
* @param string $type Possible parent type.
*
* @return boolean
*/
private function _isChildOf(PHP_PMD_AbstractNode $node, $type)
{
$parent = $node->getParent();
if ($parent->isInstanceOf($type)) {
return true;
}
return false;
}