本文整理汇总了PHP中NodeInterface类的典型用法代码示例。如果您正苦于以下问题:PHP NodeInterface类的具体用法?PHP NodeInterface怎么用?PHP NodeInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NodeInterface类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: createFromNode
public function createFromNode(NodeInterface $node)
{
$item = $this->createItem($node->getName(), $node->getOptions());
foreach ($node->getChildren() as $childNode) {
$item->addChild($this->createFromNode($childNode));
}
return $item;
}
开发者ID:ner0tic,项目名称:landmarx,代码行数:8,代码来源:LandmarkFactory.php
示例2: process
/**
* Processes an array of configurations.
*
* @param NodeInterface $configTree The node tree describing the configuration
* @param array $configs An array of configuration items to process
*
* @return array The processed configuration
*/
public function process(NodeInterface $configTree, array $configs)
{
$currentConfig = array();
foreach ($configs as $config) {
$config = $configTree->normalize($config);
$currentConfig = $configTree->merge($currentConfig, $config);
}
return $configTree->finalize($currentConfig);
}
开发者ID:ronnylt,项目名称:symfony,代码行数:17,代码来源:Processor.php
示例3: translateChild
private function translateChild(ValueObject $meta, ResultInterface $result, NodeInterface $node) : CollectionInterface
{
$relMeta = $meta->relationship();
$relationships = $result->relationships()->filter(function (RelationshipInterface $relationship) use($node, $relMeta) {
return (string) $relationship->type() === (string) $relMeta->type() && $relationship->endNode()->value() === $node->id()->value();
});
if ($relationships->count() > 1) {
throw MoreThanOneRelationshipFoundException::for($meta);
}
return $this->translateRelationship($meta, $result, $relationships->first());
}
开发者ID:innmind,项目名称:neo4j-onm,代码行数:11,代码来源:AggregateTranslator.php
示例4: process
/**
* Processes an array of configurations.
*
* @param NodeInterface $configTree The node tree describing the configuration
* @param array $configs An array of configuration items to process
* @param bool $normalizeKeys Flag indicating if config key normalization is needed. True by default.
*
* @return array The processed configuration
*/
public function process(NodeInterface $configTree, array $configs, $normalizeKeys = true)
{
if ($normalizeKeys) {
$configs = self::normalizeKeys($configs);
}
$currentConfig = array();
foreach ($configs as $config) {
$config = $configTree->normalize($config);
$currentConfig = $configTree->merge($currentConfig, $config);
}
return $configTree->finalize($currentConfig);
}
开发者ID:nicam,项目名称:symfony,代码行数:21,代码来源:Processor.php
示例5: hook_scheduler_allow_unpublishing
/**
* Allows to prevent unpublication of a scheduled node.
*
* @param \Drupal\node\NodeInterface $node
* The scheduled node that is about to be unpublished.
*
* @return bool
* FALSE if the node should not be unpublished. TRUE otherwise.
*/
function hook_scheduler_allow_unpublishing(NodeInterface $node)
{
$allowed = TRUE;
// Prevent unpublication of competition entries if not all prizes have been
// claimed.
if ($node->getType() == 'competition' && ($items = $node->field_competition_prizes->getValue())) {
$allowed = (bool) count($items);
// If unpublication is denied then inform the user why.
if (!$allowed) {
drupal_set_message(t('The competition will only be unpublished after all prizes have been claimed by the winners.'));
}
}
return $allowed;
}
开发者ID:blakefrederick,项目名称:sas-backend,代码行数:23,代码来源:scheduler.api.php
示例6: registerChild
public function registerChild(NodeInterface $node, $overwrite = false, $prepend = false)
{
$this->registerAdopters();
if ($node->getParent() !== $this) {
throw new \RuntimeException('Nodes being registered must return this node from their getParentNode method.');
}
$name = $node->getName();
if (!$overwrite && isset($this->childNodes[$name])) {
throw new \RuntimeException(sprintf('Node name %s is already registered.', $name));
}
if ($prepend) {
$this->childNodes = array_merge([$name => null], $this->getChildren(), [$name => $node]);
} else {
$this->childNodes[$name] = $node;
}
}
开发者ID:mikegibson,项目名称:sentient,代码行数:16,代码来源:Node.php
示例7: addContentNode
/**
* Adiciona um Nó ao Conteúdo
* @param NodeInterface $node Nó de Conteúdo Interno
*/
public function addContentNode(NodeInterface $node)
{
$node->setParentNode($this);
$this->_content[] = $node;
return $this;
}
开发者ID:laiello,项目名称:wanderson,代码行数:10,代码来源:NodeAbstract.php
示例8: getLabel
/**
* Render a node label
*
* @param NodeInterface $node
* @param boolean $crop This argument is deprecated as of Neos 1.2 and will be removed. Don't rely on this behavior and crop labels in the view.
* @return string
*/
public function getLabel(NodeInterface $node, $crop = true)
{
return $this->nodeDataLabelGenerator->getLabel($node->getNodeData(), $crop);
}
开发者ID:neos,项目名称:neos-development-collection,代码行数:11,代码来源:NodeDataLabelGeneratorAdaptor.php
示例9: check
private function check(NodeInterface $node) : bool
{
return $node instanceof ElementInterface && $node->attributes()->contains('role') && $node->attributes()->get('role')->value() === $this->role;
}
开发者ID:innmind,项目名称:crawler,代码行数:4,代码来源:Role.php
示例10: __construct
public function __construct(NodeInterface $entity)
{
$this->originalData = array('id' => $entity->getId(), 'left' => $entity->getLeftValue(), 'right' => $entity->getRightValue(), 'level' => $entity->getLevel(), 'isLeaf' => $entity instanceof NodeLeafInterface);
}
开发者ID:sitesupra,项目名称:sitesupra,代码行数:4,代码来源:ValidationArrayNode.php
示例11: getUriFromNode
/**
* Get the uri for the given node
*
* @param NodeInterface $node
* @return string
*/
protected function getUriFromNode(NodeInterface $node)
{
return $node->getUri();
}
开发者ID:rubensayshi,项目名称:KnpMenuBundle,代码行数:10,代码来源:MenuFactory.php
示例12: appendChild
public function appendChild(NodeInterface $node)
{
$node->setParent($this);
$this->children->add($node);
return $this;
}
开发者ID:robinbressan,项目名称:sequoia,代码行数:6,代码来源:Node.php
示例13: mergeWith
public function mergeWith(NodeInterface $node, $deep = true)
{
// @todo ensure that this method work as expected
foreach ($node->getChildren() as $key => $child) {
if (!$this->hasChild($key)) {
$this->addChild($child->duplicate());
} else {
if ($deep) {
$this->getChild($key)->mergeWith($child, $deep);
}
}
}
}
开发者ID:makinacorpus,项目名称:drupal-usync,代码行数:13,代码来源:Node.php
示例14: setChild
/**
* Set child
*
* @param int $position
* @param NodeInterface|null $child
* @return $this
*/
public function setChild($position, NodeInterface $child = null)
{
$this->children[$position] = $child;
if (null !== $child) {
$child->setParent($this)->setPosition($position);
}
return $this;
}
开发者ID:Jihell,项目名称:LibraryRBTree,代码行数:15,代码来源:AbstractNode.php
示例15: setParent
public function setParent(NodeInterface $parent)
{
$this->parent = $parent;
$this->setDepth($parent->getDepth() + 1);
}
开发者ID:honeybee,项目名称:honeybee,代码行数:5,代码来源:Node.php
示例16: writeNode
/**
* @param int $depth
*/
private function writeNode(NodeInterface $node, $depth = 0)
{
$comments = array();
$default = '';
$defaultArray = null;
$children = null;
$example = $node->getExample();
// defaults
if ($node instanceof ArrayNode) {
$children = $node->getChildren();
if ($node instanceof PrototypedArrayNode) {
$prototype = $node->getPrototype();
if ($prototype instanceof ArrayNode) {
$children = $prototype->getChildren();
}
// check for attribute as key
if ($key = $node->getKeyAttribute()) {
$keyNode = new ArrayNode($key, $node);
$keyNode->setInfo('Prototype');
// add children
foreach ($children as $childNode) {
$keyNode->addChild($childNode);
}
$children = array($key => $keyNode);
}
}
if (!$children) {
if ($node->hasDefaultValue() && count($defaultArray = $node->getDefaultValue())) {
$default = '';
} elseif (!is_array($example)) {
$default = '[]';
}
}
} else {
$default = '~';
if ($node->hasDefaultValue()) {
$default = $node->getDefaultValue();
if (true === $default) {
$default = 'true';
} elseif (false === $default) {
$default = 'false';
} elseif (null === $default) {
$default = '~';
}
}
}
// required?
if ($node->isRequired()) {
$comments[] = 'Required';
}
// example
if ($example && !is_array($example)) {
$comments[] = 'Example: '.$example;
}
$default = (string) $default != '' ? ' '.$default : '';
$comments = count($comments) ? '# '.implode(', ', $comments) : '';
$text = sprintf('%-20s %s %s', $node->getName().':', $default, $comments);
if ($info = $node->getInfo()) {
$this->writeLine('');
$this->writeLine('# '.$info, $depth * 4);
}
$this->writeLine($text, $depth * 4);
// output defaults
if ($defaultArray) {
$this->writeLine('');
$message = count($defaultArray) > 1 ? 'Defaults' : 'Default';
$this->writeLine('# '.$message.':', $depth * 4 + 4);
$this->writeArray($defaultArray, $depth + 1);
}
if (is_array($example)) {
$this->writeLine('');
$message = count($example) > 1 ? 'Examples' : 'Example';
$this->writeLine('# '.$message.':', $depth * 4 + 4);
$this->writeArray($example, $depth + 1);
}
//.........这里部分代码省略.........
开发者ID:n3b,项目名称:symfony,代码行数:101,代码来源:ReferenceDumper.php
示例17: _xpath_indirect_adjacent
/**
* Joins an XPath expression as an indirect adjacent of another.
*
* @param XPathExpr $xpath The parent XPath expression
* @param NodeInterface $sub The indirect adjacent NodeInterface object
*
* @return XPathExpr An XPath instance
*/
protected function _xpath_indirect_adjacent($xpath, $sub)
{
// when sub comes somewhere after xpath as a sibling
$xpath->join('/following-sibling::', $sub->toXpath());
return $xpath;
}
开发者ID:roojs,项目名称:pear,代码行数:14,代码来源:CombinedSelectorNode.php
示例18: getDepth
/**
* {@inheritdoc}
*/
public function getDepth()
{
if ($this->parent === null) {
return 0;
}
return $this->parent->getDepth() + 1;
}
开发者ID:LibraryOfLawrence,项目名称:pagekit,代码行数:10,代码来源:NodeTrait.php
示例19: evaluate
/**
* {@inheritdoc}
*/
public function evaluate()
{
return !$this->child->evaluate();
}
开发者ID:bit3,项目名称:contao-merger2,代码行数:7,代码来源:NotNode.php
示例20: getSpecificity
/**
* {@inheritdoc}
*/
public function getSpecificity()
{
return $this->selector->getSpecificity()->plus($this->subSelector->getSpecificity());
}
开发者ID:EnmanuelCode,项目名称:backend-laravel,代码行数:7,代码来源:NegationNode.php
注:本文中的NodeInterface类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论