WC_REST_WCCOM_Site_Controller::get_response()protectedWC 1.0

Create a WP_REST_Response.

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

Хуков нет.

Возвращает

WP_REST_Response|WP_Error.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_response( $data, $status );
$data(массив) (обязательный)
response data.
$status(int)
HTTP response status.
По умолчанию: 200

Код WC_REST_WCCOM_Site_Controller::get_response() WC 9.8.2

protected function get_response( array $data, int $status = 200 ) {
	$response = rest_ensure_response( $data );
	$response->set_status( $status );
	return $response;
}