Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
4 / 4 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
Indexer | |
100.00% |
4 / 4 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getAllIndexes | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | namespace Apie\IntegrationTests\Apie\TypeDemo\Actions; |
3 | |
4 | use Apie\Core\Attributes\Context; |
5 | use Apie\Core\Attributes\Not; |
6 | use Apie\Core\Attributes\Requires; |
7 | use Apie\Core\Attributes\Route; |
8 | use Apie\Core\Attributes\StaticCheck; |
9 | use Apie\Core\Context\ApieContext; |
10 | use Apie\Core\ContextConstants; |
11 | use Apie\Core\Indexing\Indexer as IndexingIndexer; |
12 | use Apie\Core\Lists\StringSet; |
13 | use Apie\Core\ValueObjects\EntityReference; |
14 | |
15 | class Indexer |
16 | { |
17 | public function __construct(private readonly IndexingIndexer $indexer) |
18 | { |
19 | } |
20 | |
21 | #[StaticCheck(new Not(new Requires(ContextConstants::MCP_SERVER)))] |
22 | #[Route(routeDefinition: '/indexes/{resourceName}/{id}')] |
23 | public function getAllIndexes( |
24 | #[Context()] |
25 | EntityReference $reference, |
26 | #[Context()] |
27 | ApieContext $apieContext |
28 | ): StringSet { |
29 | $object = $reference->resolve($apieContext); |
30 | $indexes = $this->indexer->getIndexesFor($object, $apieContext); |
31 | |
32 | return new StringSet(array_keys($indexes)); |
33 | } |
34 | } |