Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. HttpFulfilledPromise.php

class HttpFulfilledPromise

Hierarchy

  • class \Http\Client\Promise\HttpFulfilledPromise implements \Http\Promise\Promise

Expanded class hierarchy of HttpFulfilledPromise

File

vendor/php-http/httplug/src/Promise/HttpFulfilledPromise.php, line 9

Namespace

Http\Client\Promise
View source
final class HttpFulfilledPromise implements Promise {
    
    /**
     * @var ResponseInterface
     */
    private $response;
    public function __construct(ResponseInterface $response) {
        $this->response = $response;
    }
    public function then(?callable $onFulfilled = null, ?callable $onRejected = null) {
        if (null === $onFulfilled) {
            return $this;
        }
        try {
            return new self($onFulfilled($this->response));
        } catch (Exception $e) {
            return new HttpRejectedPromise($e);
        }
    }
    public function getState() {
        return Promise::FULFILLED;
    }
    public function wait($unwrap = true) {
        if ($unwrap) {
            return $this->response;
        }
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
HttpFulfilledPromise::$response private property
HttpFulfilledPromise::getState public function Returns the state of the promise, one of PENDING, FULFILLED or REJECTED. Overrides Promise::getState
HttpFulfilledPromise::then public function Adds behavior for when the promise is resolved or rejected (response will be available, or error happens). Overrides Promise::then
HttpFulfilledPromise::wait public function Wait for the promise to be fulfilled or rejected. Overrides Promise::wait
HttpFulfilledPromise::__construct public function
Promise::FULFILLED constant Promise has been fulfilled.
Promise::PENDING constant Promise has not been fulfilled or rejected.
Promise::REJECTED constant Promise has been rejected.

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal