本文整理汇总了PHP中Node::getPath方法的典型用法代码示例。如果您正苦于以下问题:PHP Node::getPath方法的具体用法?PHP Node::getPath怎么用?PHP Node::getPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Node
的用法示例。
在下文中一共展示了Node::getPath方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPath
/**
* @return string
*/
public function getPath()
{
if ($this->path === null) {
if ($this->parent === null || $this->parent->getPath() === null) {
$this->path = $this->name;
} else {
$this->path = $this->parent->getPath() . '/' . $this->name;
}
}
return $this->path;
}
示例2: getPath
public function getPath(&$prevNodes = [])
{
if ($this->_parent) {
array_push($prevNodes, $this);
$this->_parent->getPath($prevNodes);
}
return $prevNodes;
}
示例3: testConstructFromArray
/**
*
* @dataProvider testConstructFromArrayProvider
*/
public function testConstructFromArray($testData, $expectedData)
{
$n = new Node($testData);
extract($expectedData);
$this->assertEquals($path, $n->getPath());
$this->assertEquals($url, $n->url);
$this->assertEquals($template_data, $n->template_data);
$this->assertEquals($display_name, $n->display_name);
}
示例4: checkLocks
private function checkLocks(Node $node)
{
if ($node->isLocked()) {
throw new LockException("cannot move locked node: {$this->workspace}=>" . $node->getPath());
} else {
if ($node->hasNodes()) {
$ni = $node->getNodes();
while ($ni->hasNext()) {
$temporaryNode = $ni->nextNode();
if ($temporaryNode->hasNodes()) {
$this->checkLocks($temporaryNode);
} else {
if ($temporaryNode->isLocked()) {
throw new LockException("cannot move locked node: {$this->workspace}=>" . $temporaryNode->getPath());
}
}
}
}
}
}
示例5: _find
/**
* Internal recursion for find()
*
* @param array $ret
* @param \USync\AST\NodeInterface[] $node
* @param int $depth
*
* @return \USync\AST\NodeInterface[]
*/
protected function _find(&$ret, Node $node, $depth = 0)
{
$current = $this->segments[$depth];
if (self::MATCH === $current[0] || self::WILDCARD === $current || $node->getName() === $current) {
if ($depth === $this->size) {
$ret[$node->getPath()] = $node;
} else {
foreach ($node->getChildren() as $child) {
$this->_find($ret, $child, $depth + 1);
}
}
}
}
示例6: getQuery
/**
*
* Retrieves an existing persistent query.
* If node is not a valid persisted query, an InvalidQueryException is thrown.
* Persistent queries are created by first using QueryManager->createQuery to create a Query object and then calling Query->storeAsNode to persist the query to a location in the workspace.
* @param Node $node a persisted query.
* @return Query a Query object.
*
*/
public function getQuery(Node $node)
{
Log4PCR::info("Requested query: {$this->workspace}=>" . $node->getPath());
return new Query($this->pm, $node->getProperty('pcr:statement')->getString());
}