You are here

function inspect in Auth0 Single Sign On 8.2

Synchronously waits on a promise to resolve and returns an inspection state array.

Returns a state associative array containing a "state" key mapping to a valid promise state. If the state of the promise is "fulfilled", the array will contain a "value" key mapping to the fulfilled value of the promise. If the promise is rejected, the array will contain a "reason" key mapping to the rejection reason of the promise.

Parameters

PromiseInterface $promise Promise or value.:

Return value

array

1 call to inspect()
inspect_all in vendor/guzzlehttp/promises/src/functions.php
Waits on all of the provided promises, but does not unwrap rejected promises as thrown exception.

File

vendor/guzzlehttp/promises/src/functions.php, line 147

Namespace

GuzzleHttp\Promise

Code

function inspect(PromiseInterface $promise) {
  try {
    return [
      'state' => PromiseInterface::FULFILLED,
      'value' => $promise
        ->wait(),
    ];
  } catch (RejectionException $e) {
    return [
      'state' => PromiseInterface::REJECTED,
      'reason' => $e
        ->getReason(),
    ];
  } catch (\Throwable $e) {
    return [
      'state' => PromiseInterface::REJECTED,
      'reason' => $e,
    ];
  } catch (\Exception $e) {
    return [
      'state' => PromiseInterface::REJECTED,
      'reason' => $e,
    ];
  }
}