本文整理匯總了PHP中PHPCR\NodeInterface::accept方法的典型用法代碼示例。如果您正苦於以下問題:PHP NodeInterface::accept方法的具體用法?PHP NodeInterface::accept怎麽用?PHP NodeInterface::accept使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PHPCR\NodeInterface
的用法示例。
在下文中一共展示了NodeInterface::accept方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: visitMenu
/**
* Visit the menu tree leading to this path with a specified visitor.
*
* Implementation: the visitor is reset after each child list
*
* @see getMenu()
* @param string $path the url (without eventual prefix from routing config)
* @param ItemVisitorInterface $visitor to gather information from a node, with the same behaviour and additional methods as explained in createMenuVisitor()
* @param bool $skiproot whether to not include the root node in the collection, defaults to skipping it
* @param int $depth depth to follow unselected node children. defaults to 0 (do not follow). -1 means unlimited
*
* @return array structure with entries for each node: title, url, selected (parent of $url or $url itselves), node (the phpcr node), children (array, empty array on no children. false if not selected node and deeper away from selected node than depth.). if you skip the root, the uppermost thing is directly an array of children
*/
public function visitMenu($path, $visitor, $skiproot = true, $depth = 0)
{
if ($skiproot) {
//have a fake parentrecord
$tree = array('selected' => true, 'node' => $this->rootnode);
} else {
$this->rootnode->accept($visitor);
$tree = $visitor->getArray();
$tree = reset($tree);
//visitor just was at the root node, there is exactly one
}
$children = $this->visitMenuRecursive($tree, $path, $visitor, $depth, 0);
if ($skiproot) {
$tree = $children;
} else {
$tree['children'] = $children;
}
return $tree;
}
示例2: accept
/**
* {@inheritdoc}
*/
public function accept(ItemVisitorInterface $visitor)
{
return $this->node->accept($visitor);
}
示例3: testAccept
public function testAccept()
{
$mock = $this->getMock('PHPCR\\ItemVisitorInterface', array('visit'));
$mock->expects($this->once())->method('visit')->with($this->equalTo($this->node));
$this->node->accept($mock);
}