Yoast\WP\SEO\Dashboard\Infrastructure\Search_Console

Site_Kit_Search_Console_Adapter::validate_response()privateYoast 1.0

Validates the response coming from Search Console.

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

Хуков нет.

Возвращает

null..

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

// private - только в коде основоного (родительского) класса
$result = $this->validate_response( $response ): void;
$response(WP_REST_Response) (обязательный)
The response we want to validate.

Код Site_Kit_Search_Console_Adapter::validate_response() Yoast 25.1

private function validate_response( WP_REST_Response $response ): void {
	if ( $response->is_error() ) {
		$error_data        = $response->as_error()->get_error_data();
		$error_status_code = ( $error_data['status'] ?? 500 );
		throw new Failed_Request_Exception(
			\wp_kses_post(
				$response->as_error()
					->get_error_message()
			),
			(int) $error_status_code
		);
	}

	if ( ! \is_array( $response->get_data() ) ) {
		throw new Unexpected_Response_Exception();
	}
}