The doc comment class-string<TCollection> at position 0 could not be parsed: Unknown type name 'class-string' at position 0 in class-string<TCollection>.
Loading history...
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
38
{
39
$clone = clone $this;
40
$clone->class = $class;
41
return $clone;
42
}
43
44
public function collect(iterable $data): CollectionInterface