Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
Route
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace LambdaTwelve\OneRecord\Server;
6
7use LambdaTwelve\OneRecord\Spec\ApiVersion;
8
9/**
10 * One row of the server's route table, for hosts whose framework wants a
11 * named route per endpoint (access control, logging, alteration). The
12 * pattern uses `{id}`-style placeholders and is relative to the base path;
13 * `methods` lists every method the SDK answers so the framework passes all
14 * of them through and the SDK, not the framework, answers 405 with the
15 * spec's error body and Allow header.
16 */
17final readonly class Route
18{
19    /**
20     * @param non-empty-list<string> $methods
21     */
22    public function __construct(
23        public string $name,
24        public array $methods,
25        public string $pattern,
26        public ApiVersion $since = ApiVersion::V2_2_0,
27    ) {}
28}