YoastSEO_Vendor\GuzzleHttp\Promise
inspect() Yoast 1.0
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.
Хуков нет.
Возвращает
Массив.
Использование
inspect( \YoastSEO_Vendor\GuzzleHttp\Promise\PromiseInterface $promise );
- $promise(Promiseчислоerface) (обязательный)
- Promise or value.
Код inspect() inspect Yoast 15.6.2
function inspect(\YoastSEO_Vendor\GuzzleHttp\Promise\PromiseInterface $promise)
{
try {
return ['state' => \YoastSEO_Vendor\GuzzleHttp\Promise\PromiseInterface::FULFILLED, 'value' => $promise->wait()];
} catch (\YoastSEO_Vendor\GuzzleHttp\Promise\RejectionException $e) {
return ['state' => \YoastSEO_Vendor\GuzzleHttp\Promise\PromiseInterface::REJECTED, 'reason' => $e->getReason()];
} catch (\Throwable $e) {
return ['state' => \YoastSEO_Vendor\GuzzleHttp\Promise\PromiseInterface::REJECTED, 'reason' => $e];
} catch (\Exception $e) {
return ['state' => \YoastSEO_Vendor\GuzzleHttp\Promise\PromiseInterface::REJECTED, 'reason' => $e];
}
}