Automattic\WooCommerce\Internal
RestApiControllerBase::get_authentication_error_by_method()
Returns an authentication error message for a given HTTP verb.
Метод класса: RestApiControllerBase{}
Хуков нет.
Возвращает
Массив|null
. Error information on success, null otherwise.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_authentication_error_by_method( $method );
- $method(строка) (обязательный)
- HTTP method.
Код RestApiControllerBase::get_authentication_error_by_method() RestApiControllerBase::get authentication error by method WC 9.3.3
protected function get_authentication_error_by_method( string $method ) { $errors = array( 'GET' => array( 'code' => 'woocommerce_rest_cannot_view', 'message' => __( 'Sorry, you cannot view resources.', 'woocommerce' ), ), 'POST' => array( 'code' => 'woocommerce_rest_cannot_create', 'message' => __( 'Sorry, you cannot create resources.', 'woocommerce' ), ), 'DELETE' => array( 'code' => 'woocommerce_rest_cannot_delete', 'message' => __( 'Sorry, you cannot delete resources.', 'woocommerce' ), ), ); return $errors[ $method ] ?? null; }