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


PHP SplObjectStorage::offsetSet方法代码示例

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


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

示例1: attach

 /**
  * @param HandlerInterface $handler
  * @param array            $categories
  */
 public function attach(HandlerInterface $handler, array $categories = array())
 {
     if ($this->handlers->contains($handler)) {
         $handlerCategories = $this->handlers->offsetGet($handler);
         $this->handlers->offsetSet($handler, array_merge((array) $handlerCategories, $categories));
     } else {
         $this->handlers->attach($handler, $categories);
     }
 }
开发者ID:prgtw,项目名称:error-handler,代码行数:13,代码来源:HandlerManager.php

示例2: getObservers

 /**
  * Returns list of observers for subject
  *
  * @param SubjectInterface $s
  *
  * @return \SplObjectStorage|ObserverInterface[]
  */
 protected function getObservers(SubjectInterface $s)
 {
     if ($this->perSubjectObservers === null) {
         $this->perSubjectObservers = new \SplObjectStorage();
     }
     if (!isset($this->perSubjectObservers[$s])) {
         $observers = new \SplObjectStorage();
         $this->perSubjectObservers->offsetSet($s, $observers);
     } else {
         $observers = $this->perSubjectObservers->offsetGet($s);
     }
     return $observers;
 }
开发者ID:ssgonchar,项目名称:warlock,代码行数:20,代码来源:AbstractObserverAspect.php

示例3: offsetSet

 public function offsetSet($index, $testResult)
 {
     $indexObj = $index;
     $this->validateIndex($index);
     $this->validateValue($testResult);
     // Decrement counters when replacing existing item
     if (parent::offsetExists($index)) {
         $oldResult = parent::offsetGet($index);
         if ($oldResult instanceof Success) {
             $this->countSuccess--;
         } elseif ($oldResult instanceof Failure) {
             $this->countFailure--;
         } elseif ($oldResult instanceof Warning) {
             $this->countWarning--;
         } else {
             $this->countUnknown--;
         }
     }
     parent::offsetSet($index, $testResult);
     // Increment counters
     if ($testResult instanceof Success) {
         $this->countSuccess++;
     } elseif ($testResult instanceof Failure) {
         $this->countFailure++;
     } elseif ($testResult instanceof Warning) {
         $this->countWarning++;
     } else {
         $this->countUnknown++;
     }
 }
开发者ID:ralfeggert,项目名称:zftool,代码行数:30,代码来源:Collection.php

示例4: offsetSet

 /**
  * @param object $object
  * @param null $data
  */
 public function offsetSet($object, $data = null)
 {
     if (!$object instanceof Date) {
         throw new \InvalidArgumentException("DateObjectStorage can store only date objects");
     }
     parent::offsetSet($object, $data);
     // TODO: Change the autogenerated stub
 }
开发者ID:assertis,项目名称:util-lib,代码行数:12,代码来源:DateObjectStorage.php

示例5: setData

 /**
  * setData()
  *
  * sets the data set of a given route
  * 
  * @param \Naquadria\Components\Routing\Route $route
  * @param mixed $data
  * @throws \Naquadria\Components\Routing\Exceptions\RouteNotFoundException
  */
 public function setData(Route $route, $data)
 {
     if (!parent::contains($route)) {
         throw new RouteNotFoundException('Unknown route instance');
     }
     $current = parent::offsetGet($route);
     $current['data'] = $data;
     parent::offsetSet($route, $current);
 }
开发者ID:naquadria,项目名称:routing,代码行数:18,代码来源:RouteContainer.php

示例6: addSitemap

 /**
  * @param \Sitemapper\SitemapInterface $sitemap
  */
 public function addSitemap(SitemapInterface $sitemap)
 {
     $this->boot();
     $this->sitemaps->attach($sitemap);
     $index = $this->sitemaps->count();
     $sitemap->setLocation($this->getLocation($index));
     $this->sitemaps->offsetSet($sitemap, $index);
     $this->indexSitemap->addSitemap($sitemap);
 }
开发者ID:marcelomx,项目名称:sitemapper,代码行数:12,代码来源:Generator.php

示例7: eventsToPublishOn

 private function eventsToPublishOn(EventMessageInterface $event, EventBusInterface $eventBus)
 {
     if (!$this->eventsToPublish->contains($eventBus)) {
         $this->eventsToPublish->attach($eventBus, array($event));
         return;
     }
     $events = $this->eventsToPublish->offsetGet($eventBus);
     $events[] = $event;
     $this->eventsToPublish->offsetSet($eventBus, $events);
 }
开发者ID:fcm,项目名称:GovernorFramework,代码行数:10,代码来源:DefaultUnitOfWork.php

示例8: unsubscribe

 private function unsubscribe(WebSocketConnection $connection)
 {
     /** @var WebSocketObservableTable $table */
     $table = $this->connectionTableMap->offsetGet($connection);
     $table->removeConnection($connection);
     $this->connectionTableMap->offsetUnset($connection);
     $connections = $this->getConnectionsSubscribedToTable($table)->filter(function (WebSocketConnection $c) use($connection) {
         return $c !== $connection;
     });
     if (count($connections)) {
         $this->tableConnectionMap->offsetSet($table, $connections);
     } else {
         $this->tableConnectionMap->offsetUnset($table);
     }
 }
开发者ID:proof,项目名称:blackjack-php-server,代码行数:15,代码来源:WebSocketManager.php

示例9: offsetSet

 /**
  * Sets the value for the passed offset.
  *
  * @param int   $offset The offset to set value for
  * @param mixed $value  The value to write
  *
  * @author Benjamin Carl <opensource@clickalicious.de>
  *
  * @return mixed The result of the operation
  */
 public function offsetSet($offset, $value)
 {
     foreach ($this->observer as $observer) {
         if (strtolower($observer->getName()) === strtolower($offset)) {
             $this->observer->offsetSet($value);
         }
     }
 }
开发者ID:clickalicious,项目名称:doozr,代码行数:18,代码来源:Logging.php

示例10: addServiceInlinedDefinitionsSetup

    /**
     * Generates the inline definition setup.
     *
     * @param string     $id
     * @param Definition $definition
     *
     * @return string
     *
     * @throws ServiceCircularReferenceException when the container contains a circular reference
     */
    private function addServiceInlinedDefinitionsSetup($id, $definition)
    {
        $this->referenceVariables[$id] = new Variable('instance');

        $code = '';
        $processed = new \SplObjectStorage();
        foreach ($this->getInlinedDefinitions($definition) as $iDefinition) {
            if ($processed->contains($iDefinition)) {
                continue;
            }
            $processed->offsetSet($iDefinition);

            if (!$this->hasReference($id, $iDefinition->getMethodCalls(), true) && !$this->hasReference($id, $iDefinition->getProperties(), true)) {
                continue;
            }

            // if the instance is simple, the return statement has already been generated
            // so, the only possible way to get there is because of a circular reference
            if ($this->isSimpleInstance($id, $definition)) {
                throw new ServiceCircularReferenceException($id, array($id));
            }

            $name = (string) $this->definitionVariables->offsetGet($iDefinition);
            $code .= $this->addServiceMethodCalls(null, $iDefinition, $name);
            $code .= $this->addServiceProperties(null, $iDefinition, $name);
            $code .= $this->addServiceConfigurator(null, $iDefinition, $name);
        }

        if ('' !== $code) {
            $code .= "\n";
        }

        return $code;
    }
开发者ID:ninvfeng,项目名称:symfony,代码行数:44,代码来源:PhpDumper.php

示例11: offsetSet

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

示例12: offsetSet

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

示例13: addServiceInlinedDefinitionsSetup

 /**
  * Generates the inline definition setup.
  *
  * @param string     $id
  * @param Definition $definition
  * @return string
  */
 private function addServiceInlinedDefinitionsSetup($id, $definition)
 {
     $this->referenceVariables[$id] = new Variable('instance');
     $code = '';
     $processed = new \SplObjectStorage();
     foreach ($this->getInlinedDefinitions($definition) as $iDefinition) {
         if ($processed->contains($iDefinition)) {
             continue;
         }
         $processed->offsetSet($iDefinition);
         if (!$this->hasReference($id, $iDefinition->getMethodCalls())) {
             continue;
         }
         if ($iDefinition->getMethodCalls()) {
             $code .= $this->addServiceMethodCalls(null, $iDefinition, (string) $this->definitionVariables->offsetGet($iDefinition));
         }
         if ($iDefinition->getConfigurator()) {
             $code .= $this->addServiceConfigurator(null, $iDefinition, (string) $this->definitionVariables->offsetGet($iDefinition));
         }
     }
     if ('' !== $code) {
         $code .= "\n";
     }
     return $code;
 }
开发者ID:netvlies,项目名称:symfony,代码行数:32,代码来源:PhpDumper.php

示例14: offsetSet

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

示例15: offsetSet

 /**
  * @param object     $index
  * @param mixed|null $checkResult
  * @link http://php.net/manual/en/splobjectstorage.offsetset.php
  */
 public function offsetSet($index, $checkResult)
 {
     $this->validateIndex($index);
     $this->validateValue($checkResult);
     // Decrement counters when replacing existing item
     if (parent::offsetExists($index)) {
         $this->updateCounters(parent::offsetGet($index), -1);
     }
     // Store the new instance
     parent::offsetSet($index, $checkResult);
     // Increment counters
     $this->updateCounters($checkResult, 1);
 }
开发者ID:riteshkmr33,项目名称:ovessnce,代码行数:18,代码来源:Collection.php


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