API / Minn\Rest / RouteCatalogue

RouteCatalogue final readonly class

Minn\Rest\RouteCatalogue · public/minn/src/Minn/Rest/RouteCatalogue.php · 78 lines

The routes the engine serves, described in the reference's shape for the index and for an OPTIONS request: every route's namespace, its methods and the parameters it declares, gathered per concrete route from the attributes so a client learns what really works on it, with the namespaces they fall under. Routes are keyed as the reference spells them ('/wp/v2/posts/(?P<id>[\d]+)').

Constants and properties

privateSERVER_ROUTES = array ( 0 => '/batch/v1', )

The routes the reference's server registers itself, outside any namespace.

privatereadonly Minn\Http\Router $router

Promoted from the constructor.

privatereadonly Minn\Rest\Types $types

Promoted from the constructor.

privatereadonly Minn\Rest\RestUrl $url

Promoted from the constructor.

Public

new__construct(Minn\Http\Router $router, Minn\Rest\Types $types, Minn\Rest\RestUrl $url)#
methodall(): array#

Every route the engine serves, the root and each namespace's index among them, and the namespaces.

@return array{namespaces: list<string>, routes: array<string, array<string, mixed>>}
staticnamespaceOf(string $route): string#

The namespace a route is listed under: its first two segments when the second is a version. The routes the reference's server registers itself, the batch route among them, belong to none, so none is listed for them and their path answers no namespace index.

methoddescribing(string $path): ?array#

The first route whose pattern takes the path, as the reference finds the route an OPTIONS request describes; null when none does.

@return array<string, mixed>|null