當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。