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


PHP self::setParent方法代码示例

本文整理汇总了PHP中self::setParent方法的典型用法代码示例。如果您正苦于以下问题:PHP self::setParent方法的具体用法?PHP self::setParent怎么用?PHP self::setParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在self的用法示例。


在下文中一共展示了self::setParent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getComponent

 /**
  * @param $name
  * @return ComponentAssert
  */
 public function getComponent($name)
 {
     $c = $this->getObject();
     $assert = new self($c[$name]);
     $assert->setParent($this);
     return $assert;
 }
开发者ID:venne,项目名称:tester,代码行数:11,代码来源:ComponentAssert.php

示例2: addTextChild

 public function addTextChild($text)
 {
     $child = new self();
     $child->setParent($this);
     $child->setText($text);
     $this->addChild($child);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:7,代码来源:GWF_BBCodeItem.php

示例3: getInstanceById

	public static function getInstanceById($reportModel) {
		$self = new self();
		$db = PearDatabase::getInstance();
		$result = $db->pquery('SELECT * FROM vtiger_reporttype WHERE reportid = ?', array($reportModel->getId()));
		$data = $db->query_result($result, 0, 'data');
		if(!empty($data)) {
			$decodeData = Zend_Json::decode(decode_html($data));
			$self->setData($decodeData);
			$self->setParent($reportModel);
			$self->setId($reportModel->getId());
		}
		return $self;
	}
开发者ID:Wasage,项目名称:werpa,代码行数:13,代码来源:Chart.php

示例4: add

 function add($idobj)
 {
     if (!is_object($idobj)) {
         $idobj = new self($idobj);
     } else {
         if (!$idobj instanceof self) {
             throw new Exception("type mismatch");
         }
     }
     $idobj->setParent($this);
     $this->and = $idobj;
     return $idobj;
 }
开发者ID:jabouzi,项目名称:projet,代码行数:13,代码来源:IdentityObject3.php

示例5: group

 /**
  * @param $options
  * @param callable $callback
  * @return RouteCollection
  */
 public function group($options, callable $callback = null)
 {
     if (!isset($callback) && is_callable($options)) {
         $callback = $options;
         $options = [];
     }
     $child = new self($options);
     $child->setParent($this);
     $this->children[] = $child;
     if (isset($callback)) {
         call_user_func($callback, $child);
     }
     return $child;
 }
开发者ID:catlabinteractive,项目名称:charon,代码行数:19,代码来源:RouteCollection.php

示例6: manualLoad

 static function manualLoad($file, &$obj, $params = [])
 {
     $apply = new self();
     $apply->setParent($obj);
     $apply->parseFile($file, $params, 'apply');
     foreach ($apply->childNodes as $i => $extender) {
         if ($extender instanceof COMMENT || $extender instanceof TEXT || $extender instanceof PHP) {
             unset($apply->childNodes[$i]);
             continue;
         }
         if (method_exists($extender, 'applyLoad')) {
             $extender->applyLoad($obj);
         } else {
             $selector = $extender->nodeName;
             foreach ($extender->attributes as $k => $v) {
                 $selector .= '[' . $k . '="' . $v . '"]';
             }
             $obj->children($selector, true)->write($extender);
         }
     }
 }
开发者ID:redcatphp,项目名称:templix,代码行数:21,代码来源:Apply.php

示例7: __get

    /**
     * Map variable access onto the underlying entry representation.
     *
     * Get-style access returns a Zend_Feed_Element representing the
     * child element accessed. To get string values, use method syntax
     * with the __call() overriding.
     *
     * @param  string $var The property to access.
     * @return mixed
     */
    public function __get($var)
    {
        $nodes = $this->_children($var);
        $length = count($nodes);

        if ($length == 1) {
            return new Zend_Feed_Element($nodes[0]);
        } elseif ($length > 1) {
            return array_map(create_function('$e', 'return new Zend_Feed_Element($e);'), $nodes);
        } else {
            // When creating anonymous nodes for __set chaining, don't
            // call appendChild() on them. Instead we pass the current
            // element to them as an extra reference; the child is
            // then responsible for appending itself when it is
            // actually set. This way "if ($foo->bar)" doesn't create
            // a phantom "bar" element in our tree.
            if (strpos($var, ':') !== false) {
                list($ns, $elt) = explode(':', $var, 2);
                $node = $this->_element->ownerDocument->createElementNS(Zend_Feed::lookupNamespace($ns), $elt);
            } else {
                $node = $this->_element->ownerDocument->createElement($var);
            }
            $node = new self($node);
            $node->setParent($this);
            return $node;
        }
    }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:37,代码来源:Element.php

示例8: addWalk

 /**
  * Adds a new subchain and returns its instance.
  *
  * @return \Jyxo\Input\Chain
  */
 public function addWalk() : self
 {
     $chain = new self();
     $chain->setParent($this);
     $this->chain[] = [self::WALK, $chain];
     return $chain;
 }
开发者ID:jyxo,项目名称:php,代码行数:12,代码来源:Chain.php

示例9: copy

 /**
  * Creates a copy of this node including its pages
  *
  * This does not persist anything.
  * @todo This is untested!
  * @param boolean $recursive (optional) Wheter copy all children to the new node or not, default false
  * @param Node $newParent (optional) New parent node for the copy, default is parent of this
  * @param boolean $persist (optional) Wheter to persist new entities or not, default true, if set to false, be sure to persist everything
  * @return \Cx\Core\ContentManager\Model\Entity\Node Copy of this node
  */
 public function copy($recursive = false, Node $newParent = null, $persist = true)
 {
     $em = \Env::get('cx')->getDb()->getEntityManager();
     if (!$newParent) {
         $newParent = $this->getParent();
     }
     $copy = new self();
     $copy->setParent($newParent);
     if ($persist) {
         $em->persist($copy);
     }
     foreach ($this->getPages(true) as $page) {
         $pageCopy = $page->copyToNode($copy);
         if ($persist) {
             $em->persist($pageCopy);
         }
     }
     if (!$recursive) {
         return $copy;
     }
     foreach ($this->getChildren() as $child) {
         $copy->addParsedChild($child->copy(true, $copy));
     }
     return $copy;
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:35,代码来源:Node.class.php

示例10: addWalk

 /**
  * Adds a new subchain and returns its instance.
  *
  * @return \Jyxo\Input\Chain
  */
 public function addWalk()
 {
     $chain = new self();
     $chain->setParent($this);
     $this->chain[] = array(self::WALK, $chain);
     return $chain;
 }
开发者ID:JerryCR,项目名称:php-2,代码行数:12,代码来源:Chain.php

示例11: newParent

 /**
  * Returns a new parent Context
  * 
  * @return Context 
  */
 public function newParent()
 {
     $ctx = new self($this->request);
     $ctx->setParent($this);
     return $ctx;
 }
开发者ID:fwk,项目名称:core,代码行数:11,代码来源:Context.php

示例12: hasChild

 /**
  * @param string $selector
  *
  * @return Element
  */
 public function hasChild($selector)
 {
     $this->assertAtLeast($this->valueIsSet()->value);
     $asserter = new self($this->getGenerator(), $this->getAnalyzer(), $this->getLocale());
     $asserter->setParent($this)->setWith($this->valueIsSet()->value->filter($selector));
     return $asserter;
 }
开发者ID:aliel,项目名称:AtoumBundle,代码行数:12,代码来源:Element.php

示例13: mount

 /**
  * Mount a Mux or a Controller object on a specific path.
  *
  * @param string         $pattern
  * @param Mux|Controller $mux
  * @param array          $options
  */
 public function mount($pattern, $mux, array $options = array())
 {
     // Save the mount path in options array
     $options['mount_path'] = $pattern;
     if ($mux instanceof Expandable) {
         $mux = $mux->expand($options);
     } else {
         if ($mux instanceof Closure) {
             // we pass the newly created Mux object to the builder closure to initialize routes.
             if ($ret = $mux($mux = new Mux())) {
                 if ($ret instanceof Mux) {
                     $mux = $ret;
                 } else {
                     throw new LogicException('Invalid object returned from Closure.');
                 }
             }
         } elseif ((!is_object($mux) || !$mux instanceof self) && is_callable($mux)) {
             $mux($mux = new self());
         }
     }
     // Save the constructed mux object in options array, so we can fetch
     // the expanded mux object in controller object later.
     $mux->setParent($this);
     $options['mux'] = $mux;
     if ($this->expand) {
         $pcre = strpos($pattern, ':') !== false;
         // rewrite submux routes
         foreach ($mux->routes as $route) {
             // process for pcre
             if ($route[0] || $pcre) {
                 $newPattern = $pattern . ($route[0] ? $route[3]['pattern'] : $route[1]);
                 $routeArgs = PatternCompiler::compile($newPattern, array_replace_recursive($options, $route[3]));
                 $this->appendPCRERoute($routeArgs, $route[2]);
             } else {
                 $this->routes[] = array(false, $pattern . $route[1], $route[2], isset($route[3]) ? array_replace_recursive($options, $route[3]) : $options);
             }
         }
     } else {
         $muxId = $mux->getId();
         $this->add($pattern, $muxId, $options);
         $this->submux[$muxId] = $mux;
     }
 }
开发者ID:router-front,项目名称:Pux,代码行数:50,代码来源:Mux.php

示例14: insert

 public function insert(Comparable $element)
 {
     $compareResult = $this->compareToValue($element);
     if ($compareResult !== 0) {
         foreach ($this->children as $child) {
             if ($child->getValue()->compareTo($element) === 0) {
                 throw new DuplicateEntryException('Value is already present - cannot insert two elements with same value.');
             }
         }
         $item = new self($element);
         $item->setParent($this);
         $this->children[] = $item;
         return $item;
     } else {
         throw new DuplicateEntryException('Value is already present - cannot insert two elements with same value.');
     }
 }
开发者ID:nathanklick,项目名称:collections,代码行数:17,代码来源:NaryTreeNode.php

示例15: setData

 /**
  * Overrides Entity's setData to process the replies and package them as
  * objects
  *
  * @access public
  * @param  array $data
  */
 public function setData(array $data)
 {
     parent::setData($data);
     if (isset($data['replies']['data']['children'])) {
         foreach ($data['replies']['data']['children'] as $reply) {
             $comment = new self($this->reddit);
             $comment->setData($reply['data']);
             $comment->setParent($this);
             $this->replies[] = $comment;
         }
     }
 }
开发者ID:judge2020,项目名称:ChannelBot,代码行数:19,代码来源:Comment.php


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