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


PHP SplObjectStorage::offsetGet方法代码示例

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


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

示例1: onNext

 /**
  * @param EventInterface $value
  * @throws \Exception
  */
 public function onNext($value)
 {
     $uri = $value->getName();
     // TODO add route cache
     foreach ($this->routing as $subject) {
         /* @var ReplaySubject $subject */
         $routes = $this->routing->offsetGet($subject);
         foreach ($routes as $data) {
             if (!preg_match($data['regex'], $uri, $matches)) {
                 continue;
             }
             $vars = [];
             $i = 0;
             foreach ($data['routeMap'] as $varName) {
                 $vars[$varName] = $matches[++$i];
             }
             $labels = $value->getLabels();
             $labels = array_merge($labels, $vars);
             $value->setLabels($labels);
             $subject->onNext($value);
             return;
         }
     }
     throw new \Exception("not found");
 }
开发者ID:domraider,项目名称:rxnet,代码行数:29,代码来源:EventSource.php

示例2: getHelperForEntityType

 /**
  * @param \AGmakonts\STL\String\Text $entityType
  *
  * @return AbstractRepository
  * @throws \AGmakonts\DddBricks\Repository\Exception\HelperException
  */
 protected function getHelperForEntityType(Text $entityType)
 {
     if (FALSE === $this->_helpers->offsetExists($entityType)) {
         throw new HelperException(HelperException::HELPER_UNKNOWN);
     }
     return $this->_helpers->offsetGet($entityType);
 }
开发者ID:agmakonts,项目名称:ddd-bricks,代码行数:13,代码来源:AbstractRepository.php

示例3: fetch

 /**
  * @param Peer $peer
  * @return PeerState
  */
 public function fetch(Peer $peer)
 {
     if (!$this->storage->contains($peer)) {
         $state = $this->createState($peer);
     } else {
         $state = $this->storage->offsetGet($peer);
     }
     return $state;
 }
开发者ID:sbwdlihao,项目名称:node-php,代码行数:13,代码来源:PeerStateCollection.php

示例4: 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

示例5: finish

 /**
  * {@inheritdoc}
  */
 public function finish(RequestInterface $request, ResponseInterface $response)
 {
     if ($this->isTerminableKernel) {
         list($sfRequest, $sfResponse) = $this->requestMapping->offsetGet($request);
         $this->requestMapping->detach($request);
         $kernel = $this->kernel;
         /* @var $kernel TerminableInterface */
         $kernel->terminate($sfRequest, $sfResponse);
     }
 }
开发者ID:syrma-php,项目名称:web-container-bundle,代码行数:13,代码来源:SymfonyRequestHandler.php

示例6: onMessage

 /**
  * Triggered when a client sends data through the socket
  * @param  \Ratchet\ConnectionInterface $from The socket/connection that sent the message to your application
  * @param  string $msg The message received
  * @throws \Exception
  *
  * expects:
  * { 'cmd': "identifier", 'payload': {<data>}}
  * could use bson instead
  */
 function onMessage(ConnectionInterface $from, $msg)
 {
     $from = $this->connections->offsetGet($from);
     if (null === ($json = @json_decode($msg, true))) {
         throw new JsonException();
     }
     if (!is_array($json)) {
         throw new Exception("Invalid message");
     }
     $this->wrapped->onMessage($from, $json);
 }
开发者ID:carnage,项目名称:ratchet-json-server,代码行数:21,代码来源:JsonServer.php

示例7: 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

示例8: save

 /**
  * @return bool
  */
 public function save()
 {
     $pkField = self::getAutoIncrementField();
     if ($this->isNewRecord()) {
         if (($id = $this->insertGetId((array) $this)) > 0) {
             $this->{$pkField} = $id;
             return true;
         }
         return false;
     } else {
         $original = unserialize(static::$modelStorage->offsetGet($this));
         return 1 == $this->where($pkField . '=?', array($original[$pkField]))->update((array) $this);
     }
 }
开发者ID:pfinal,项目名称:database,代码行数:17,代码来源:ActiveRecord.php

示例9: getValidationGroups

 /**
  * Returns the validation groups of the given form.
  *
  * @param  FormInterface $form The form.
  *
  * @return array The validation groups.
  */
 private static function getValidationGroups(FormInterface $form)
 {
     $root = $form->getRoot();
     // Determine the clicked button of the complete form tree
     if (!static::$clickedButtons->contains($root)) {
         // Only call findClickedButton() once to prevent an exponential
         // runtime
         // https://github.com/symfony/symfony/issues/8317
         static::$clickedButtons->attach($root, self::findClickedButton($root));
     }
     $button = static::$clickedButtons->offsetGet($root);
     if (null !== $button) {
         $groups = $button->getConfig()->getOption('validation_groups');
         if (null !== $groups) {
             return self::resolveValidationGroups($groups, $form);
         }
     }
     do {
         $groups = $form->getConfig()->getOption('validation_groups');
         if (null !== $groups) {
             return self::resolveValidationGroups($groups, $form);
         }
         $form = $form->getParent();
     } while (null !== $form);
     return array(Constraint::DEFAULT_GROUP);
 }
开发者ID:koumba,项目名称:monsiteweb.com,代码行数:33,代码来源:FormValidator.php

示例10: evaluate

 /**
  * Call the view helper associated with this object.
  *
  * First, it evaluates the arguments of the view helper.
  *
  * If the view helper implements \TYPO3\Fluid\Core\ViewHelper\Facets\ChildNodeAccessInterface,
  * it calls setChildNodes(array childNodes) on the view helper.
  *
  * Afterwards, checks that the view helper did not leave a variable lying around.
  *
  * @param RenderingContextInterface $renderingContext
  * @return object evaluated node after the view helper has been called.
  */
 public function evaluate(RenderingContextInterface $renderingContext)
 {
     if ($this->viewHelpersByContext->contains($renderingContext)) {
         $viewHelper = $this->viewHelpersByContext->offsetGet($renderingContext);
         $viewHelper->resetState();
     } else {
         $viewHelper = clone $this->uninitializedViewHelper;
         $this->viewHelpersByContext->attach($renderingContext, $viewHelper);
     }
     $evaluatedArguments = array();
     if (count($viewHelper->prepareArguments())) {
         /** @var $argumentDefinition ArgumentDefinition */
         foreach ($viewHelper->prepareArguments() as $argumentName => $argumentDefinition) {
             if (isset($this->arguments[$argumentName])) {
                 /** @var $argumentValue NodeInterface */
                 $argumentValue = $this->arguments[$argumentName];
                 $evaluatedArguments[$argumentName] = $argumentValue->evaluate($renderingContext);
             } else {
                 $evaluatedArguments[$argumentName] = $argumentDefinition->getDefaultValue();
             }
         }
     }
     $viewHelper->setArguments($evaluatedArguments);
     $viewHelper->setViewHelperNode($this);
     $viewHelper->setRenderingContext($renderingContext);
     if ($viewHelper instanceof ChildNodeAccessInterface) {
         $viewHelper->setChildNodes($this->childNodes);
     }
     $output = $viewHelper->initializeArgumentsAndRender();
     return $output;
 }
开发者ID:nlx-sascha,项目名称:flow-development-collection,代码行数:44,代码来源:ViewHelperNode.php

示例11: saveSitemap

 /**
  * @param \Sitemapper\SitemapInterface $sitemap
  */
 protected function saveSitemap(SitemapInterface $sitemap)
 {
     if ($this->sitemaps->contains($sitemap)) {
         $index = $this->sitemaps->offsetGet($sitemap);
         $this->saveFile($this->getPathname($index), $sitemap->getOutput());
         $this->savedSitemaps->attach($sitemap);
     }
 }
开发者ID:marcelomx,项目名称:sitemapper,代码行数:11,代码来源:Generator.php

示例12: getConnectionsSubscribedToTable

 /**
  * @param WebSocketObservableTable $table
  *
  * @return Vector|WebSocketConnection[]
  */
 private function getConnectionsSubscribedToTable(WebSocketObservableTable $table)
 {
     try {
         return $this->tableConnectionMap->offsetGet($table);
     } catch (\Exception $e) {
         return new Vector();
     }
 }
开发者ID:proof,项目名称:blackjack-php-server,代码行数:13,代码来源:WebSocketManager.php

示例13: getData

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

示例14: handleItems

 public function handleItems($object, array $items, SerializationContext $context)
 {
     if ($this->deferredData->contains($object)) {
         $items = array_merge($this->deferredData->offsetGet($object), $items);
         $this->deferredData->detach($object);
     }
     $parentObjectInlining = $this->getParentObjectInlining($object, $context);
     if (null === $parentObjectInlining) {
         return $items;
     }
     if ($this->deferredData->contains($parentObjectInlining)) {
         $items = array_merge($items, $this->deferredData->offsetGet($parentObjectInlining));
     }
     // We need to defer the links serialization to the $parentObject
     $this->deferredData->attach($parentObjectInlining, $items);
     return array();
 }
开发者ID:anhpha,项目名称:reports,代码行数:17,代码来源:InlineDeferrer.php

示例15: flush

 /**
  * Send data to database
  *
  * @return \Sokil\Mongo\Persistence
  */
 public function flush()
 {
     /** @var $document \Sokil\Mongo\Document */
     foreach ($this->_pool as $document) {
         switch ($this->_pool->offsetGet($document)) {
             case self::STATE_SAVE:
                 $document->save();
                 break;
             case self::STATE_REMOVE:
                 // delete document form db
                 $document->delete();
                 // remove link form pool
                 $this->detach($document);
                 break;
         }
     }
     return $this;
 }
开发者ID:bingochen87,项目名称:php-mongo,代码行数:23,代码来源:Persistence.php


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