Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
8 / 8 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
McpServerRouteDefinitionProvider | |
100.00% |
8 / 8 |
|
100.00% |
3 / 3 |
4 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getGlobalRoutes | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
2 | |||
getActionsForBoundedContext | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | namespace Apie\McpServer\RouteDefinitions; |
3 | |
4 | use Apie\Common\Interfaces\GlobalRouteDefinitionProviderInterface; |
5 | use Apie\Common\RouteDefinitions\ActionHashmap; |
6 | use Apie\Core\BoundedContext\BoundedContext; |
7 | use Apie\Core\Context\ApieContext; |
8 | use Apie\Core\Enums\RequestMethod; |
9 | use Apie\Core\ValueObjects\UrlRouteDefinition; |
10 | |
11 | class McpServerRouteDefinitionProvider implements GlobalRouteDefinitionProviderInterface |
12 | { |
13 | public function __construct(private ?string $remotePath) |
14 | { |
15 | } |
16 | |
17 | public function getGlobalRoutes(): ActionHashmap |
18 | { |
19 | if ($this->remotePath !== null) { |
20 | return new ActionHashmap([ |
21 | 'mcp_server_post' => new ExternalMcpRouteDefinition(new UrlRouteDefinition($this->remotePath), RequestMethod::POST), |
22 | 'mcp_server_get' => new ExternalMcpRouteDefinition(new UrlRouteDefinition($this->remotePath), RequestMethod::GET), |
23 | ]); |
24 | } |
25 | return new ActionHashmap([]); |
26 | } |
27 | public function getActionsForBoundedContext(BoundedContext $boundedContext, ApieContext $apieContext): ActionHashmap |
28 | { |
29 | |
30 | return new ActionHashmap([]); |
31 | } |
32 | } |