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


PHP SplObjectStorage::addAll方法代码示例

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


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

示例1: addAll

 /**
  * @param \SplObjectStorage $storage
  */
 public function addAll($storage)
 {
     parent::addAll($storage);
     if ($storage instanceof self) {
         $this->unreferenced->addAll($storage->unreferenced);
     }
 }
开发者ID:mrxotey,项目名称:icicle,代码行数:10,代码来源:ObjectStorage.php

示例2: merge

 /**
  * Merge storages
  *
  * @param self $storage
  *
  * @return self
  */
 public function merge(self $storage) : self
 {
     $objects = new \SplObjectStorage();
     $objects->addAll($this->objects);
     $objects->addAll($storage->objects);
     return new self($objects);
 }
开发者ID:Innmind,项目名称:Immutable,代码行数:14,代码来源:ObjectStorage.php

示例3: assign

 /**
  * assign data
  * @param mixed $pData
  */
 public function assign($pData)
 {
     switch (true) {
         case $pData instanceof \SplObjectStorage:
             $this->data->addAll($pData);
             break;
         case \is_array($pData):
             foreach ($pData as $row) {
                 $this->data->attach((object) $row);
             }
             break;
     }
 }
开发者ID:Broncko,项目名称:Savant,代码行数:17,代码来源:CDataSet.php

示例4: addAll

 /**
  * @param \SplObjectStorage $object
  * @throws Exception\WrongArgument
  */
 public function addAll($object)
 {
     if (!$object instanceof SMSCollection) {
         throw new Exception\WrongArgument();
     }
     parent::addAll($object);
 }
开发者ID:pontifex,项目名称:sms,代码行数:11,代码来源:SMSCollection.php

示例5: addAll

 /**
  * @param \SplObjectStorage $storage
  */
 public function addAll($storage)
 {
     if (!$storage instanceof \SplObjectStorage) {
         throw new \InvalidArgumentException("DateObjectStorage can be merge only with \\SplObjectStorage object.");
     }
     foreach ($storage as $element) {
         if (!$element instanceof Date) {
             throw new \InvalidArgumentException("DateObjectStorage can store only date objects");
         }
     }
     parent::addAll($storage);
     // TODO: Change the autogenerated stub
 }
开发者ID:assertis,项目名称:util-lib,代码行数:16,代码来源:DateObjectStorage.php

示例6: getLosers

 /**
  * Calculate the losers and return an splStorageObject of them.
  * @param  splStprageObject $clients
  * @param  RoundHelper $helper  A helper class with utility functions.
  * @return SplStorageObject The losers.
  */
 private function getLosers($clients, $helper)
 {
     $losers = new \SplObjectStorage();
     $a1 = $helper->generateAnswerObject(1, $clients);
     $a2 = $helper->generateAnswerObject(2, $clients);
     $a3 = $helper->generateAnswerObject(3, $clients);
     $count = $helper->minCount($a1, $a2, $a3);
     foreach ([$a1, $a2, $a3] as $spl) {
         if ($spl->count() !== $count) {
             $losers->addAll($spl);
         }
     }
     return $losers;
 }
开发者ID:Techbot,项目名称:ratchet-based-game,代码行数:20,代码来源:RoundProcessor.php

示例7: parse

 public function parse(Project $project, $callback = null)
 {
     $step = 0;
     $steps = iterator_count($this->iterator);
     $context = $this->parser->getContext();
     $transaction = new Transaction($project);
     $toStore = new \SplObjectStorage();
     foreach ($this->iterator as $file) {
         ++$step;
         $code = file_get_contents($file);
         $hash = sha1($code);
         if ($transaction->hasHash($hash)) {
             continue;
         }
         $context->enterFile((string) $file, $hash);
         $this->parser->parse($code);
         if (null !== $callback) {
             call_user_func($callback, Message::PARSE_ERROR, $context->getErrors());
         }
         foreach ($context->leaveFile() as $class) {
             if (null !== $callback) {
                 call_user_func($callback, Message::PARSE_CLASS, array(floor($step / $steps * 100), $class));
             }
             $project->addClass($class);
             $transaction->addClass($class);
             $toStore->attach($class);
             $class->notFromCache();
         }
     }
     // cleanup
     foreach ($transaction->getRemovedClasses() as $class) {
         $project->removeClass(new LazyClassReflection($class));
         $this->store->removeClass($project, $class);
     }
     // visit each class for stuff that can only be done when all classes are parsed
     $toStore->addAll($this->traverser->traverse($project));
     foreach ($toStore as $class) {
         $this->store->writeClass($project, $class);
     }
     return $transaction;
 }
开发者ID:kpocha,项目名称:Sami,代码行数:41,代码来源:Parser.php

示例8: addAll

 public function addAll($storage)
 {
     $this->initialize();
     parent::addAll($storage);
 }
开发者ID:patrickreck,项目名称:flow-development-collection,代码行数:5,代码来源:LazySplObjectStorage.php

示例9: addAll

 /**
  * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0.
  */
 public function addAll($storage)
 {
     @trigger_error('The ' . __METHOD__ . ' method is deprecated as of 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
     parent::addAll($storage);
 }
开发者ID:0mars,项目名称:symfony,代码行数:8,代码来源:Crawler.php

示例10: makeNeatArray

 /**
  * Recursively goes through an array and makes neat HTML out of it.
  *
  * @param mixed $values Array to make pretty.
  * @param int $openDepth Depth to add open class
  * @param int $currentDepth current depth.
  * @param bool $doubleEncode Whether or not to double encode.
  * @param \SplObjectStorage $currentAncestors Object references found down
  * the path.
  * @return string
  */
 public function makeNeatArray($values, $openDepth = 0, $currentDepth = 0, $doubleEncode = false, \SplObjectStorage $currentAncestors = null)
 {
     if ($currentAncestors === null) {
         $ancestors = new \SplObjectStorage();
     } elseif (is_object($values)) {
         $ancestors = new \SplObjectStorage();
         $ancestors->addAll($currentAncestors);
         $ancestors->attach($values);
     } else {
         $ancestors = $currentAncestors;
     }
     $className = "neat-array depth-{$currentDepth}";
     if ($openDepth > $currentDepth) {
         $className .= ' expanded';
     }
     $nextDepth = $currentDepth + 1;
     $out = "<ul class=\"{$className}\">";
     if (!is_array($values)) {
         if (is_bool($values)) {
             $values = [$values];
         }
         if ($values === null) {
             $values = [null];
         }
         if (is_object($values) && method_exists($values, 'toArray')) {
             $values = $values->toArray();
         }
     }
     if (empty($values)) {
         $values[] = '(empty)';
     }
     if ($this->sort && is_array($values) && $currentDepth === 0) {
         ksort($values);
     }
     foreach ($values as $key => $value) {
         $out .= '<li><strong>' . h($key, $doubleEncode) . '</strong>';
         if (is_array($value) && count($value) > 0) {
             $out .= '(array)';
         } elseif (is_object($value)) {
             $out .= '(object)';
         }
         if ($value === null) {
             $value = '(null)';
         }
         if ($value === false) {
             $value = '(false)';
         }
         if ($value === true) {
             $value = '(true)';
         }
         if (empty($value) && $value != 0) {
             $value = '(empty)';
         }
         if ($value instanceof Closure) {
             $value = 'function';
         }
         $isObject = is_object($value);
         if ($isObject && $ancestors->contains($value)) {
             $isObject = false;
             $value = ' - recursion';
         }
         if (($value instanceof ArrayAccess || $value instanceof Iterator || is_array($value) || $isObject) && !empty($value)) {
             $out .= $this->makeNeatArray($value, $openDepth, $nextDepth, $doubleEncode, $ancestors);
         } else {
             $out .= h($value, $doubleEncode);
         }
         $out .= '</li>';
     }
     $out .= '</ul>';
     return $out;
 }
开发者ID:cakephp,项目名称:debug_kit,代码行数:82,代码来源:ToolbarHelper.php

示例11: addAll

 /**
  * @deprecated Using the SplObjectStorage API on the Crawler is deprecated as of 2.8 and will be removed in 3.0.
  */
 public function addAll($storage)
 {
     $this->triggerDeprecation(__METHOD__);
     parent::addAll($storage);
 }
开发者ID:hudsonventura,项目名称:ModularCore,代码行数:8,代码来源:Crawler.php

示例12: insert

 private function insert($breadcrumb, $position)
 {
     if ($position < 0) {
         $position += $this->breadcrumbs->count();
     } else {
         // $position >= 1
         $position--;
     }
     $breadcrumbs = new \SplObjectStorage();
     $breadcrumbs->addAll($this->breadcrumbs);
     $this->breadcrumbs->removeAll($this->breadcrumbs);
     $breadcrumbs->rewind();
     while ($breadcrumbs->valid()) {
         if (max(0, $position) == $breadcrumbs->key()) {
             $this->breadcrumbs->attach($breadcrumb);
         }
         $this->breadcrumbs->attach($breadcrumbs->current());
         $breadcrumbs->next();
     }
 }
开发者ID:absalonvaldes,项目名称:APYBreadcrumbTrailBundle,代码行数:20,代码来源:Trail.php

示例13: array

<?php

$data_provider = array(array(), true, "string", 12345, 1.2345, NULL);
foreach ($data_provider as $input) {
    $s = new SplObjectStorage();
    var_dump($s->addAll($input));
}
开发者ID:badlamer,项目名称:hhvm,代码行数:7,代码来源:SplObjectStorage_addAll_invalid_parameter.php

示例14: _CLASS

 protected function _CLASS($elem)
 {
     if ($var = $elem['VAR']) {
         $extends = [];
         $parents = new \SplObjectStorage();
         $constructors = [];
         $prototype = [];
         if (isset($elem['EXTENDS'])) {
             foreach ($elem['EXTENDS'] as $child) {
                 isset($child[SIGN_MAP]) and $child = $this->map($child);
                 if ($parents->contains($class = $this->getVarClass($child['CLASS']))) {
                     throw new iXmlException("Class '" . $this->getVarDebug($var) . "' cannot extend '" . $this->getVarDebug($child['CLASS']) . "' repeatedly");
                 }
                 $extends[] = $class;
                 $parents->attach($class);
                 $parents->addAll($class->parents);
                 $constructors = array_merge($constructors, $class->constructors);
                 $prototype = $class->prototype + $prototype;
             }
         }
         if (isset($elem['PROPERTY'])) {
             foreach ($elem['PROPERTY'] as $child) {
                 isset($child[SIGN_MAP]) and $child = $this->map($child);
                 $property_var = $child['VAR'];
                 $prototype[($name = $child['NAME']) === '' && $property_var ? isset($property_var[1]) ? end($property_var[1]) : $property_var[0] : $name] = $property_var ? $this->getVar($property_var) : $child[SIGN_CDATA];
             }
         }
         isset($elem['CONSTRUCTOR']) and $constructors[] = $elem['CONSTRUCTOR'][0][SIGN_CHILD];
         if (isset($elem['METHOD'])) {
             foreach ($elem['METHOD'] as $child) {
                 isset($child[SIGN_MAP]) and $child = $this->map($child);
                 $prototype[$child['NAME']] = new iXmlFunctionSimple(isset($child[SIGN_CHILD]) ? $child[SIGN_CHILD] : []);
             }
         }
         $this->setVar($var, new iXmlClass($extends, $parents, $constructors, $prototype));
     }
 }
开发者ID:dapepe,项目名称:tymio,代码行数:37,代码来源:ixml.php

示例15: SplObjectStorage

<?php

/**
 * spl数据结构demo
 * 对象容器 SplObjectStorage
 *
 */
// 实例化
$obj = new SplObjectStorage();
// addAll(SplObjectStorage $storage)
// 将另一个对象容器的对象数据全部加入到自己的对象中
$o = new StdClass();
$obj_1 = new SplObjectStorage();
$obj_1[$o] = 'hello';
$obj->addAll($obj_1);
//echo $obj[$o]; // hello
// attach(object $object[, mixed $data=null])
// 往对象容器中添加对象
$a1 = new StdClass();
$a2 = new StdClass();
$obj->attach($a1);
$obj->attach($a2, 'class 2');
$obj->attach($a2, array('k1' => 'class 2'));
// detach(object $object)
// 将参数对象从对象容器中分离
$obj->detach($o);
// $obj[$o] 报错,找不到对象
// contains(object $object)
// 判断对象容器是否存在该对象
$obj->contains($o);
// false
开发者ID:ray0916,项目名称:learn,代码行数:31,代码来源:splObjectStorage.php


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