Responses final class
Minn\Rest\Responses · public/minn/src/Minn/Rest/Responses.php · 95 lines
REST answers as the WordPress layer shapes them: any value made a response, a list of errors made one (its status from the errors' data), the REST server (made, and rest_api_init told, the first time it is asked), the fields a request asked for kept, and the status that tells a signed-out caller from one who may not.
Public
| static | ensure(mixed $response): mixed# | A value as a REST response (rest_ensure_response): errors and responses as they are; an HTTP response's parts carried over. |
| static | fromErrors(mixed $error): Minn\Objects\RestResponse# | A list of errors as a REST response (rest_convert_error_to_response): the first error the body, the rest as additional_errors; the status the last one the errors' data name, 500 when none does. |
| static | server(): mixed# | The REST server (rest_get_server): made the first time, of the class wp_rest_server_class names, and rest_api_init told. |
| static | fieldIncluded(mixed $field, mixed $fields): bool# | Whether a field is among those asked for (rest_is_field_included), a nested one by its parent or child. |
| static | filterFields(mixed $response, mixed $server, mixed $request): mixed# | A response with only the fields the request's _fields asks for (rest_filter_response_fields), a list item by item. |
| static | authorizationRequiredCode(): int# | The status refusing a caller (rest_authorization_required_code): 403 for one signed in, 401 for one who is not. |
Internals 1
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | entries(mixed $error): array# | Each error as the REST body writes it: code, message, its code's last data, and the earlier data as additional_data. @return list<array<string, mixed>> |
Nothing matches.