The following interfaces are defined to easy the process of creating/converting collections/collection items to basic PHP types.
This interface defines how to create a collection item from an iterable:
interface FromIterable
{
public static function fromIterable(iterable $data): self|static;
}
This interface defines how to create a collection item from an array:
interface FromArray
{
public static function fromArray(array $data): self|static;
}
This interface defines how to convert a collection item (or a collection itself) to an array:
interface ToArray
{
public function toArray(): array;
}
This interface defines how to create a collection item from an integer:
interface FromInt
{
public static function fromInt(int $value): self|static;
}
This interface defines how to convert a collection item to an integer:
interface ToInt
{
public function toInt(): int;
}
This interface defines how to create a collection item from a string:
interface FromString
{
public static function fromString(string $value): self|static;
}
This interface defines how to convert a collection item to a string:
interface ToString
{
public function toString(): string;
}