b374k
m1n1 1.01
Apache/2.4.41 (Ubuntu)
Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64
uid=33(www-data) gid=33(www-data) groups=33(www-data)
server ip : 62.171.164.128 | your ip : 127.0.0.1
safemode OFF
 >  / home / a / home / dev2.destoffenstraat.com / vendor / ezimuel / ringphp / src / Future /
Filename/home/a/home/dev2.destoffenstraat.com/vendor/ezimuel/ringphp/src/Future/CompletedFutureValue.php
Size1.51 kb
Permissionrw-r--r--
Ownerroot : root
Create time21-Aug-2025 12:26
Last modified07-Dec-2022 12:28
Last accessed22-Aug-2025 13:54
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
<?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);
}
}