本文整理匯總了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;
}