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


PHP NodeInterface类代码示例

本文整理汇总了PHP中NodeInterface的典型用法代码示例。如果您正苦于以下问题:PHP NodeInterface类的具体用法?PHP NodeInterface怎么用?PHP NodeInterface使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了NodeInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


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