本文整理汇总了PHP中Node::getParent方法的典型用法代码示例。如果您正苦于以下问题:PHP Node::getParent方法的具体用法?PHP Node::getParent怎么用?PHP Node::getParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Node
的用法示例。
在下文中一共展示了Node::getParent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: attachChild
/**
* Attach a child node
*
* @param \Zend\Server\Reflection\Node $node
* @return void
*/
public function attachChild(Node $node)
{
$this->children[] = $node;
if ($node->getParent() !== $this) {
$node->setParent($this);
}
}
示例2: findParent
function findParent(Node $node, $type = null)
{
if ($node->getType() == $type) {
return $node;
} else {
findParent($node->getParent(), $type);
}
}
示例3: copyBefore
/**
* Copy the current node to a new location, as a sibling of given node.
* @param vakata\phptree\Node $reference the reference node
* @return vakata\phptree\Node the newly create node
*/
public function copyBefore(Node $reference)
{
$id = $this->tree->copy($this->id, $reference->getParent()->getID(), $reference->getIndex());
return $this->tree->node($id);
}
示例4: isSiblingWith
/**
* Test if the node is a sibling of a given node.
* @param Node $inNode Node to compare with.
* @return bool If the node is a sibling of the given node, then the method returns the value `true`.
* Otherwise, it returns the value `false`.
*/
public function isSiblingWith(Node $inNode)
{
return $this->getParent() === $inNode->getParent();
}