![]() 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/inventory.corals.io/vendor/php-http/promise/src/ |
<?php namespace Http\Promise; /** * A promise already fulfilled. * * @author Joel Wurtz <[email protected]> */ final class FulfilledPromise implements Promise { /** * @var mixed */ private $result; /** * @param $result */ public function __construct($result) { $this->result = $result; } /** * {@inheritdoc} */ public function then(callable $onFulfilled = null, callable $onRejected = null) { if (null === $onFulfilled) { return $this; } try { return new self($onFulfilled($this->result)); } catch (\Exception $e) { return new RejectedPromise($e); } } /** * {@inheritdoc} */ public function getState() { return Promise::FULFILLED; } /** * {@inheritdoc} */ public function wait($unwrap = true) { if ($unwrap) { return $this->result; } } }