Yoast\WP\SEO\Config

Wincher_PKCE_Provider::getParsedResponse()publicYoast 1.0

Parses the request response.

Метод класса: Wincher_PKCE_Provider{}

Хуков нет.

Возвращает

Массив. The parsed response.

Использование

$Wincher_PKCE_Provider = new Wincher_PKCE_Provider();
$Wincher_PKCE_Provider->getParsedResponse( $request );
$request(RequestInterface) (обязательный)
The request interface.

Код Wincher_PKCE_Provider::getParsedResponse() Yoast 20.0

public function getParsedResponse( RequestInterface $request ) {
	try {
		$response = $this->getResponse( $request );
	} catch ( BadResponseException $e ) {
		$response = $e->getResponse();
	}

	$parsed = $this->parseResponse( $response );

	$this->checkResponse( $response, $parsed );

	// We always expect an array from the API except for on DELETE requests.
	// We convert to an array here to prevent problems with array_key_exists on PHP8.
	if ( ! \is_array( $parsed ) ) {
		$parsed = [ 'data' => [] ];
	}

	// Add the response code as this is omitted from Winchers API.
	if ( ! \array_key_exists( 'status', $parsed ) ) {
		$parsed['status'] = $response->getStatusCode();
	}

	return $parsed;
}