WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Самая быстрая Тема-конструктор для WordPress
функция не описана

WPSEO_Ryte_Request::process_response() protected Yoast 1.0

Processes the given Ryte response.

{} Это метод класса: WPSEO_Ryte_Request{}

Хуков нет.

Возвращает

Массив. The response body or the error detaiils on failure.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->process_response( $response );
$response(массив/WP_Error) (обязательный)
The response or WP_Error to process.

Код WPSEO_Ryte_Request::process_response() Yoast 15.1.1

<?php
protected function process_response( $response ) {
	// Most of the potential errors are WP_Error(s).
	if ( is_wp_error( $response ) ) {
		return [
			'is_error'       => true,
			'raw_error_code' => '',
			// WP_Error codes aren't that helpful for users, let's display them in a less prominent way.
			'wp_error_code'  => '(' . $response->get_error_code() . ')',
			'message'        => $response->get_error_message(),
		];
	}

	/*
	 * As of February 2020 the Ryte API returns an error 500 for non-reachable
	 * sites. There's also the need to handle any potential raw HTTP error.
	 */
	if ( wp_remote_retrieve_response_code( $response ) !== 200 ) {
		// Not all HTTP errors may have a response message. Let's provide a default one.
		$response_message = wp_remote_retrieve_response_message( $response );
		$message          = ( $response_message ) ? $response_message : __( 'The request to Ryte returned an error.', 'wordpress-seo' );

		return [
			'is_error'       => true,
			'raw_error_code' => wp_remote_retrieve_response_code( $response ),
			'wp_error_code'  => '',
			'message'        => $message,
		];
	}

	// When the request is successful, the response code will be 200.
	$response_body = wp_remote_retrieve_body( $response );

	return json_decode( $response_body, true );
}