WPSEO_MyYoast_Api_Request::decode_response()protectedYoast 1.0

Decodes the JSON encoded response.

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

Хуков нет.

Возвращает

stdClass. The json decoded response.

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

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

Код WPSEO_MyYoast_Api_Request::decode_response() Yoast 22.4

protected function decode_response( $response ) {
	$response = json_decode( $response );

	if ( ! is_object( $response ) ) {
		throw new WPSEO_MyYoast_Invalid_JSON_Exception(
			esc_html__( 'No JSON object was returned.', 'wordpress-seo' )
		);
	}

	return $response;
}