API / Minn\Http / RouteRow

RouteRow final readonly class

Minn\Http\RouteRow · public/minn/src/Minn/Http/RouteRow.php · 81 lines

One line of the route table: what a route is, who it is for, and what it takes, read from the attribute and the handler method alone, so the table can be built from the classes without a request, a database, or a site. This is the row the REST index, the docs, and contracts/api/routes.json are written from.

Constants and properties

propreadonly string $method

Promoted from the constructor.

propreadonly string $pattern

Promoted from the constructor.

propreadonly string $name

Promoted from the constructor.

propreadonly string $handler

Promoted from the constructor.

propreadonly string $summary

Promoted from the constructor.

propreadonly ?Minn\Http\Policy $policy

Promoted from the constructor.

propreadonly array $args

Promoted from the constructor.

propreadonly array $body

Promoted from the constructor.

propreadonly bool $index

Promoted from the constructor.

propreadonly ?string $params

Promoted from the constructor.

propreadonly string $regex

Promoted from the constructor.

Public

new__construct(string $method, string $pattern, string $name, string $handler, string $summary, ?Minn\Http\Policy $policy, array $args, array $body, bool $index, ?string $params = NULL, string $regex = '')#
$argsarray<string, array<string, mixed>>the query parameters the route reads
$bodyarray<string, array<string, mixed>>the JSON body parameters it reads
$paramsclass-string<RouteParams>|nullwhere the parameters come from when they depend on the path
staticof(Minn\Http\Route $route, ReflectionMethod $method): self#

The row for one attribute on one handler method; the name defaults to the handler.

methodargsFor(string $route): array#

The parameters as the index publishes them for one concrete route the pattern takes (a {base} route's parameters are that base's).

@return array<string, array<string, mixed>>
methodtoArray(): array#

The row as data, for the JSON catalogue. @return array<string, mixed>

@return array<string, mixed>

Internals 1

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privatesummary(string $doc): string#

The first sentence of a docblock, the way the API docs read it.