![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/ezimuel/ringphp/src/Future/ |
<?php namespace GuzzleHttp\Ring\Future; use React\Promise\FulfilledPromise; use React\Promise\RejectedPromise; use React\Promise\PromiseInterface; /** * Represents a future value that has been resolved or rejected. */ class CompletedFutureValue implements FutureInterface { protected $result; protected $error; private $cachedPromise; /** * @param mixed $result Resolved result * @param \Exception $e Error. Pass a GuzzleHttp\Ring\Exception\CancelledFutureAccessException * to mark the future as cancelled. */ public function __construct($result, \Exception $e = null) { $this->result = $result; $this->error = $e; } /** * @return mixed */ public function wait() { if ($this->error) { throw $this->error; } return $this->result; } public function cancel() {} /** * @return PromiseInterface */ public function promise() { if (!$this->cachedPromise) { $this->cachedPromise = $this->error ? new RejectedPromise($this->error) : new FulfilledPromise($this->result); } return $this->cachedPromise; } /** * @return PromiseInterface */ public function then( callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null ) { return $this->promise()->then($onFulfilled, $onRejected, $onProgress); } }