Total Complexity | 3 |
Total Lines | 28 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
26 | * @method IteratorAggregate<int, ControllerInterface> getAll() |
||
27 | */ |
||
28 | class ControllerCollection implements Countable |
||
29 | { |
||
30 | use CollectionTrait; |
||
31 | |||
32 | /** |
||
33 | * Collection constructor. |
||
34 | * |
||
35 | 60 | * @param IteratorAggregate<int, ControllerInterface> $items |
|
36 | */ |
||
37 | 60 | public function __construct( |
|
38 | 60 | private IteratorAggregate $items, |
|
39 | 60 | private LoggerInterface $logger, |
|
40 | ) { |
||
|
|||
41 | 1 | } |
|
42 | |||
43 | 1 | public function getErrorMessage(string $className): string |
|
44 | 1 | { |
|
45 | 1 | return sprintf('REST controller \'%s\' does not exist', $className); |
|
46 | } |
||
47 | |||
48 | 1 | public function filter(string $className): Closure |
|
49 | { |
||
50 | return static fn (ControllerInterface $restController): bool => $restController instanceof $className; |
||
51 | 57 | } |
|
52 | } |
||
53 |