Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
9 / 9 |
|
100.00% |
7 / 7 |
CRAP | |
100.00% |
1 / 1 |
StaticContentRoute | |
100.00% |
9 / 9 |
|
100.00% |
7 / 7 |
7 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getMethod | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getUrl | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getController | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getRouteAttributes | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
getOperationId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getUrlPrefixes | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | namespace Apie\TypescriptClientBuilder\RouteDefinitions; |
3 | |
4 | use Apie\Common\Interfaces\HasRouteDefinition; |
5 | use Apie\Common\Lists\UrlPrefixList; |
6 | use Apie\Core\Enums\RequestMethod; |
7 | use Apie\Core\ValueObjects\UrlRouteDefinition; |
8 | use Apie\TypescriptClientBuilder\Controllers\StaticContentController; |
9 | |
10 | class StaticContentRoute implements HasRouteDefinition |
11 | { |
12 | public function __construct( |
13 | private string $localFilepath, |
14 | private string $urlPath |
15 | ) { |
16 | } |
17 | |
18 | public function getMethod(): RequestMethod |
19 | { |
20 | return RequestMethod::GET; |
21 | } |
22 | public function getUrl(): UrlRouteDefinition |
23 | { |
24 | return new UrlRouteDefinition($this->urlPath . '/{filename}'); |
25 | } |
26 | /** |
27 | * @return class-string<object> |
28 | */ |
29 | public function getController(): string |
30 | { |
31 | return StaticContentController::class; |
32 | } |
33 | /** |
34 | * @return array<string, mixed> |
35 | */ |
36 | public function getRouteAttributes(): array |
37 | { |
38 | return [ |
39 | 'localFilepath' => $this->localFilepath, |
40 | ]; |
41 | } |
42 | public function getOperationId(): string |
43 | { |
44 | return 'static_content_' . str_replace('/', '_', $this->urlPath); |
45 | } |
46 | public function getUrlPrefixes(): UrlPrefixList |
47 | { |
48 | return new UrlPrefixList([]); |
49 | } |
50 | } |