本文整理汇总了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);
}