RuntimeEnvelope final readonly class
Minn\Rest\RuntimeEnvelope · public/minn/src/Minn/Rest/RuntimeEnvelope.php · 123 lines · implements Minn\Http\Envelope
The REST server's filters around one of Minn's own routes, as the reference runs them around every route (contracts/runtime.md, "The REST server's envelope"): rest_request_before_callbacks is handed the argument check's error or null and may refuse; the route's permission is the next refusal; rest_dispatch_request may answer in place of the route; rest_request_after_callbacks sees whatever came of it and may change it. A value other than an error from the first filter does not answer: the route still runs. With nothing hooked on any of the three, the route answers as it would without plugins, unconverted; and before the runtime boots (the API is built first) there are no plugins to ask.
Constants and properties
| private | FILTERS = array ( 0 => 'rest_request_before_callbacks', 1 => 'rest_dispatch_request', 2 => 'rest_request_after_callbacks', ) | |
| private | readonly Minn\Rest\Types $types | Promoted from the constructor. |
Public
| new | __construct(Minn\Rest\Types $types)# |
| |||
| method | around(Minn\Http\Matched $matched, Minn\Http\Request $request, ?Minn\RestError $invalid, ?Minn\RestError $refusal, Closure $invoke): Minn\Http\Response# | The route's answer with the server's filters around it, or as the route gives it when no plugin can hear. |
Internals 6
Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.
| private | plain(?Minn\RestError $invalid, ?Minn\RestError $refusal, Closure $invoke): Minn\Http\Response# | The route answering as it does without plugins: the refusals thrown in the router's own order. | |||
| private | run(Closure $invoke): WP_REST_Response|WP_Error# | The route's answer as the server's filters hand it on: a response object, or the error it refused with. | |||
| private | routeName(Minn\Http\Matched $matched, Minn\Http\Request $request): string# | The route as the reference names it in its table: the form of the pattern this request matched. | |||
| private | handler(Minn\Http\Matched $matched, ?Minn\RestError $refusal): array# | The handler as plugins read it from the filters: its methods, its arguments as the index publishes them, and callables for the route and its permission. @return array<string, mixed> | |||
| private | defaults(array $args): array# |
| |||
| private | typed(array $captures): array# | The captures as the reference holds them once its arguments passed: a number is an integer.
@return array<string, int|string> |
Nothing matches.