Total Complexity | 7 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | final class LoophpCollectionFactory implements CollectionFactoryInterface |
||
16 | { |
||
17 | /** @var class-string<TCollection> */ |
||
|
|||
18 | private string $class = Collection::class; |
||
19 | |||
20 | public function __construct() |
||
21 | { |
||
22 | if (!class_exists(Collection::class, true)) { |
||
23 | throw new CollectionFactoryException( |
||
24 | sprintf( |
||
25 | 'There is no %s class. To resolve this issue you can install `loophp/collection` package.', |
||
26 | Collection::class |
||
27 | ) |
||
28 | ); |
||
29 | } |
||
30 | } |
||
31 | |||
32 | public function getInterface(): ?string |
||
33 | { |
||
34 | return CollectionInterface::class; |
||
35 | } |
||
36 | |||
37 | public function withCollectionClass(string $class): static |
||
42 | } |
||
43 | |||
44 | public function collect(iterable $data): iterable |
||
51 |