function inspect in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/guzzlehttp/promises/src/functions.php \GuzzleHttp\Promise\inspect()
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 141
Namespace
GuzzleHttp\PromiseCode
function inspect(PromiseInterface $promise) {
try {
return [
'state' => PromiseInterface::FULFILLED,
'value' => $promise
->wait(),
];
} catch (RejectionException $e) {
return [
'state' => 'rejected',
'reason' => $e
->getReason(),
];
} catch (\Exception $e) {
return [
'state' => 'rejected',
'reason' => $e,
];
}
}