コード例 #1
0
ファイル: MultiRunner.php プロジェクト: jrdncchr/merlinleads
 /**
  * Remove promise from runner
  *
  * @param PromiseCore $core
  */
 public function remove(PromiseCore $core)
 {
     foreach ($this->cores as $index => $existed) {
         if ($existed === $core) {
             curl_multi_remove_handle($this->multiHandle, $core->getHandle());
             unset($this->cores[$index]);
             return;
         }
     }
 }
コード例 #2
0
ファイル: CurlPromise.php プロジェクト: php-http/curl-client
 /**
  * Wait for the promise to be fulfilled or rejected.
  *
  * When this method returns, the request has been resolved and the appropriate callable has terminated.
  *
  * When called with the unwrap option
  *
  * @param bool $unwrap Whether to return resolved value / throw reason or not
  *
  * @return \Psr\Http\Message\ResponseInterface|null Resolved value, null if $unwrap is set to false
  *
  * @throws \Http\Client\Exception The rejection reason.
  */
 public function wait($unwrap = true)
 {
     $this->runner->wait($this->core);
     if ($unwrap) {
         if ($this->core->getState() === self::REJECTED) {
             throw $this->core->getException();
         }
         return $this->core->getResponse();
     }
     return null;
 }