24 lines
428 B
PHP
24 lines
428 B
PHP
![]() |
<?php
|
||
|
|
||
|
declare(strict_types=1);
|
||
|
|
||
|
namespace Loom\Utility\Collection;
|
||
|
|
||
|
use Loom\Utility\Collection\Interface\CollectionInterface;
|
||
|
|
||
|
class AbstractCollection implements CollectionInterface
|
||
|
{
|
||
|
public function __construct(protected array $items = [])
|
||
|
{
|
||
|
}
|
||
|
|
||
|
public function add(mixed $item): void
|
||
|
{
|
||
|
$this->items[] = $item;
|
||
|
}
|
||
|
|
||
|
public function toArray(): array
|
||
|
{
|
||
|
return $this->items;
|
||
|
}
|
||
|
}
|