当前位置: 首页>>代码示例>>PHP>>正文


PHP NodeInterface::accept方法代码示例

本文整理汇总了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;
 }
开发者ID:ronnylt,项目名称:symfony-cmf,代码行数:32,代码来源:HierarchyWalker.php

示例2: accept

 /**
  * {@inheritdoc}
  */
 public function accept(ItemVisitorInterface $visitor)
 {
     return $this->node->accept($visitor);
 }
开发者ID:sulu,项目名称:sulu,代码行数:7,代码来源:SuluNode.php

示例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);
 }
开发者ID:laurentiuc,项目名称:phpcr-api-tests,代码行数:6,代码来源:NodeReadMethodsTest.php


注:本文中的PHPCR\NodeInterface::accept方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。