Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
87.50% |
7 / 8 |
|
85.71% |
6 / 7 |
CRAP | |
0.00% |
0 / 1 |
| ExternalMcpRouteDefinition | |
87.50% |
7 / 8 |
|
85.71% |
6 / 7 |
7.10 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getOperationId | |
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% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getUrlPrefixes | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | namespace Apie\McpServer\RouteDefinitions; |
| 3 | |
| 4 | use Apie\Common\Enums\UrlPrefix; |
| 5 | use Apie\Common\Interfaces\HasRouteDefinition; |
| 6 | use Apie\Common\Lists\UrlPrefixList; |
| 7 | use Apie\Core\Enums\RequestMethod; |
| 8 | use Apie\Core\ValueObjects\UrlRouteDefinition; |
| 9 | use Apie\McpServer\Controllers\RemoteMcpController; |
| 10 | |
| 11 | class ExternalMcpRouteDefinition implements HasRouteDefinition |
| 12 | { |
| 13 | public function __construct(private readonly UrlRouteDefinition $url, private readonly RequestMethod $method) |
| 14 | { |
| 15 | } |
| 16 | |
| 17 | public function getOperationId(): string |
| 18 | { |
| 19 | return 'mcp_remote_' . strtolower($this->method->value); |
| 20 | } |
| 21 | |
| 22 | public function getMethod(): RequestMethod |
| 23 | { |
| 24 | return $this->method; |
| 25 | } |
| 26 | |
| 27 | public function getUrl(): UrlRouteDefinition |
| 28 | { |
| 29 | return $this->url; |
| 30 | } |
| 31 | |
| 32 | public function getController(): string |
| 33 | { |
| 34 | return RemoteMcpController::class; |
| 35 | } |
| 36 | |
| 37 | public function getRouteAttributes(): array |
| 38 | { |
| 39 | return [ |
| 40 | ]; |
| 41 | } |
| 42 | |
| 43 | public function getUrlPrefixes(): UrlPrefixList |
| 44 | { |
| 45 | return new UrlPrefixList([UrlPrefix::API, UrlPrefix::CMS]); |
| 46 | } |
| 47 | } |