⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.144
Server IP:
157.245.143.252
Server:
Linux www 6.11.0-9-generic #9-Ubuntu SMP PREEMPT_DYNAMIC Mon Oct 14 13:19:59 UTC 2024 x86_64
Server Software:
nginx/1.26.0
PHP Version:
8.3.11
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
php
/
React
/
Promise
/
Internal
/
View File Name :
FulfilledPromise.php
*/ final class FulfilledPromise implements PromiseInterface { /** @var T */ private $value; /** * @param T $value * @throws \InvalidArgumentException */ public function __construct($value = null) { if ($value instanceof PromiseInterface) { throw new \InvalidArgumentException('You cannot create React\Promise\FulfilledPromise with a promise. Use React\Promise\resolve($promiseOrValue) instead.'); } $this->value = $value; } /** * @template TFulfilled * @param ?(callable((T is void ? null : T)): (PromiseInterface
|TFulfilled)) $onFulfilled * @return PromiseInterface<($onFulfilled is null ? T : TFulfilled)> */ public function then(?callable $onFulfilled = null, ?callable $onRejected = null): PromiseInterface { if (null === $onFulfilled) { return $this; } try { /** * @var PromiseInterface
|T $result */ $result = $onFulfilled($this->value); return resolve($result); } catch (\Throwable $exception) { return new RejectedPromise($exception); } } public function catch(callable $onRejected): PromiseInterface { return $this; } public function finally(callable $onFulfilledOrRejected): PromiseInterface { return $this->then(function ($value) use ($onFulfilledOrRejected): PromiseInterface { return resolve($onFulfilledOrRejected())->then(function () use ($value) { return $value; }); }); } public function cancel(): void { } /** * @deprecated 3.0.0 Use `catch()` instead * @see self::catch() */ public function otherwise(callable $onRejected): PromiseInterface { return $this->catch($onRejected); } /** * @deprecated 3.0.0 Use `finally()` instead * @see self::finally() */ public function always(callable $onFulfilledOrRejected): PromiseInterface { return $this->finally($onFulfilledOrRejected); } }