本文整理匯總了PHP中PHPCR\NodeInterface::hasNodes方法的典型用法代碼示例。如果您正苦於以下問題:PHP NodeInterface::hasNodes方法的具體用法?PHP NodeInterface::hasNodes怎麽用?PHP NodeInterface::hasNodes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PHPCR\NodeInterface
的用法示例。
在下文中一共展示了NodeInterface::hasNodes方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: nodeToArray
/**
*
* Returns an array representation of a PHPCR node
*
* @param string $name
* @param \PHPCR\NodeInterface $node
*
* @return array
*/
private function nodeToArray($name, $node)
{
$has_children = $node->hasNodes();
return array('data' => $name, 'attr' => array('id' => $node->getPath(), 'url_safe_id' => substr($node->getPath(), 1), 'rel' => 'node'), 'state' => $has_children ? 'closed' : null);
}
示例2: exportDocumentViewRecursive
/**
* Recursively output node and all its children into the file in the
* document view format
*
* @param NodeInterface $node the node to output
* @param NamespaceRegistryInterface $ns The namespace registry to export namespaces too
* @param resource $stream the resource to write data out to
* @param boolean $skipBinary A boolean governing whether binary properties
* are to be serialized.
* @param boolean $noRecurse A boolean governing whether the subgraph at
* absPath is to be recursed.
* @param boolean $root Whether this is the root node of the resulting
* document, meaning the namespace declarations have to be included in
* it.
*/
private static function exportDocumentViewRecursive(NodeInterface $node, NamespaceRegistryInterface $ns, $stream, $skipBinary, $noRecurse, $root = false)
{
$nodename = self::escapeXmlName($node->getName());
fwrite($stream, "<{$nodename}");
if ($root) {
self::exportNamespaceDeclarations($ns, $stream);
}
foreach ($node->getProperties() as $name => $property) {
/** @var $property \PHPCR\PropertyInterface */
if ($property->isMultiple()) {
// skip multiple properties. jackrabbit does this too. cheap but whatever. use system view for a complete export
continue;
}
if (PropertyType::BINARY == $property->getType()) {
if ($skipBinary) {
continue;
}
$value = base64_encode($property->getString());
} else {
$value = htmlspecialchars($property->getString());
}
fwrite($stream, ' ' . self::escapeXmlName($name) . '="' . $value . '"');
}
if ($noRecurse || !$node->hasNodes()) {
fwrite($stream, '/>');
} else {
fwrite($stream, '>');
foreach ($node as $child) {
if (!($child->getDepth() == 1 && NodeHelper::isSystemItem($child))) {
self::exportDocumentViewRecursive($child, $ns, $stream, $skipBinary, $noRecurse);
}
}
fwrite($stream, "</{$nodename}>");
}
}
示例3: testHasNodesTrue
public function testHasNodesTrue()
{
$this->assertTrue($this->node->hasNodes());
}
示例4: hasNodes
/**
* {@inheritdoc}
*/
public function hasNodes()
{
return $this->node->hasNodes();
}
示例5: formatNodeName
public function formatNodeName(NodeInterface $node)
{
return sprintf('%s%s', $node->getName(), $node->hasNodes() ? '/' : '');
}