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


PHP SplQueue::dequeue方法代码示例

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


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

示例1: startPendingTasks

 /**
  * Starts pending tasks end move them from the pendingQueue to the runningQueue
  */
 private function startPendingTasks()
 {
     while (count($this->runningTasks) < $this->concurrencyLimit && !$this->pendingTasks->isEmpty()) {
         /** @var TaskInterface $task */
         $task = $this->pendingTasks->dequeue();
         $task->start()->progress(function (Event $notification) {
             $this->deferred->notify($notification);
         })->always(function () use($task) {
             $this->finishedTasks[] = $task;
             $this->deferred->notify(new TaskFinishedEvent($this, $task));
         });
         $this->deferred->notify(new TaskStartedEvent($this, $task));
         $this->runningTasks->enqueue($task);
     }
 }
开发者ID:jderusse,项目名称:async,代码行数:18,代码来源:MultiTasks.php

示例2: getLoggedEvent

 /**
  * @return LogEvent
  */
 public function getLoggedEvent() : LogEvent
 {
     if (!$this->hasLoggedEvents()) {
         throw new \LogicException('No more events logged!');
     }
     return $this->logs->dequeue();
 }
开发者ID:algatux,项目名称:mongo-bundle,代码行数:10,代码来源:MongoLogger.php

示例3: onExit

 public function onExit($status)
 {
     if ($this->pendingRequests->count() > 0) {
         $nextExpectedTest = $this->pendingRequests->dequeue();
         $this->distributor->testCompleted($this, TestResult::errorFromRequest($nextExpectedTest, "Worker{$this->id} died\n{$this->testErr}"));
     }
 }
开发者ID:vektah,项目名称:phpunit-parallel,代码行数:7,代码来源:WorkerTestExecutor.php

示例4: pop

 /** @return Error|null */
 public static function pop()
 {
     if (!self::$errors) {
         return null;
     }
     return self::$errors->count() > 0 ? self::$errors->dequeue() : null;
 }
开发者ID:Eygle,项目名称:INeedU,代码行数:8,代码来源:ErrorManager.class.php

示例5: deliver

 /**
  * Deliver notifications via given instance of Notifier
  * @param Notifier $notifier
  */
 public function deliver(Notifier $notifier)
 {
     foreach ($this->queue as $notification) {
         $notifier->notify($notification);
         $this->queue->dequeue();
     }
 }
开发者ID:northdakota,项目名称:DiamanteDeskBundle,代码行数:11,代码来源:NotificationDeliveryManager.php

示例6: __invoke

 public function __invoke($id, $service)
 {
     if ($this->middlewares->isEmpty()) {
         return $service;
     }
     $method = $this->middlewares->dequeue();
     return call_user_func($method, $this->container, new Next($this->container, $this->middlewares), $id, $service);
 }
开发者ID:mrferos,项目名称:GenieDi,代码行数:8,代码来源:Next.php

示例7: close

 public function close()
 {
     if (!$this->promises->isEmpty()) {
         $this->promises->dequeue()->resolve();
     } else {
         $this->current--;
     }
 }
开发者ID:voidcontext,项目名称:filesystem,代码行数:8,代码来源:OpenFileLimiter.php

示例8: uncork

 public function uncork()
 {
     if (!$this->corked) {
         return;
     }
     while (!$this->corked && !$this->writeBuffer->isEmpty()) {
         $this->doWrite(...$this->writeBuffer->dequeue());
     }
 }
开发者ID:joshdifabio,项目名称:object-stream,代码行数:9,代码来源:WritableObjectStreamTrait.php

示例9: getQuery

 /**
  * @inheritDoc
  */
 public function getQuery(Driver $driver, $link)
 {
     if (!$this->pool->contains($link)) {
         throw new \OutOfBoundsException(sprintf('Undefined %s in the pooling controller.', $driver->info($link)));
     }
     if (!$this->waiting->isEmpty()) {
         return $this->waiting->dequeue();
     }
     $this->idle->enqueue($link);
 }
开发者ID:repo2,项目名称:query-reactor,代码行数:13,代码来源:PoolingController.php

示例10: processQueue

 protected function processQueue()
 {
     $this->loop->futureTick(function () {
         if ($this->callQueue->isEmpty()) {
             return;
         }
         $message = $this->callQueue->dequeue();
         $data = ['function' => $message->getFunction(), 'args' => $message->getArgs(), 'errorResultCode' => $message->getErrorResultCode()];
         $message->getDeferred()->resolve($data);
     });
 }
开发者ID:voidcontext,项目名称:filesystem,代码行数:11,代码来源:QueuedInvoker.php

示例11: releaseConnection

 /**
  * Once a connection has finished being used...
  * @param Connection $connection
  */
 public function releaseConnection(Connection $connection)
 {
     // If we have any promises waiting for the connection, pass it along.
     if ($this->waiting->count() > 0) {
         $cb = $this->waiting->dequeue();
         $cb($connection);
         return;
     }
     // Otherwise, move it to the idle queue.
     $this->available->enqueue($connection);
 }
开发者ID:dustingraham,项目名称:react-mysql,代码行数:15,代码来源:ConnectionPool.php

示例12: __invoke

 /**
  * @param Message $chapterCommand
  * @param mixed $data
  * @param ChapterLogger $chapterLogger
  */
 public function __invoke(Message $chapterCommand, $data, ChapterLogger $chapterLogger)
 {
     $done = $this->done;
     // No middleware remains; done
     if ($this->queue->isEmpty()) {
         return $done($chapterCommand, $data, $chapterLogger);
     }
     $stage = $this->queue->dequeue();
     $executeStage = $this->executeStage;
     return $executeStage($stage, $chapterCommand, $data, $chapterLogger, $this);
 }
开发者ID:proophsoftware,项目名称:done-process,代码行数:16,代码来源:Next.php

示例13: run

 private function run()
 {
     /** @var HttpServer $server */
     $server = $this->container->get('http_server');
     // Run async dispatcher
     $server->getLoop()->addPeriodicTimer(Timer::MIN_INTERVAL, function (Timer $timer) {
         if ($this->queue->isEmpty()) {
             $timer->cancel();
             return;
         }
         $event = $this->queue->dequeue();
         $this->dispatch($event);
     });
 }
开发者ID:inisire,项目名称:framework,代码行数:14,代码来源:EventDispatcher.php

示例14: __invoke

 /**
  * @param Request $request
  * @param Response $response
  * @param callable[] ...$callables unshift callables (top priority)
  * @return Response
  */
 public function __invoke(Request $request, Response $response, ...$callables)
 {
     while ($callable = array_pop($callables)) {
         $this->queue->unshift($callable);
     }
     if ($this->queue->isEmpty()) {
         return $response;
     }
     $callable = $this->resolve($this->queue->dequeue());
     if (is_callable($callable)) {
         return call_user_func($callable, $request, $response, $this);
     } else {
         throw new \UnexpectedValueException();
     }
 }
开发者ID:assouan,项目名称:stretcher,代码行数:21,代码来源:Stretcher.php

示例15: render

 /**
  * Process the given queue of template files and
  * returns the generated output.
  *
  * @param string $file
  *
  * @return string
  * @throws RendererException
  */
 public function render(string $file) : string
 {
     if ($this->rendering) {
         throw new RendererException("Cannot call render() inside templates.");
     }
     $this->rendering = true;
     $this->queue->enqueue($file);
     $this->sections()->declare('content');
     ob_start();
     while (!$this->queue->isEmpty()) {
         $file = $this->engine->path($this->queue->dequeue());
         if (!file_exists($file)) {
             throw new \RuntimeException("Cannot find file: {$file}");
         }
         require $file;
         $this->sections()->populate('content', ob_get_contents(), 'replace');
         ob_clean();
         if ($this->extended) {
             $this->extended = false;
         }
     }
     ob_end_clean();
     $this->rendering = false;
     return $this->sections()->fetch('content');
 }
开发者ID:Trivivium,项目名称:Cascade,代码行数:34,代码来源:Renderer.php


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