utility.collection/src/AbstractCollection.php

24 lines
428 B
PHP
Raw Normal View History

<?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;
}
}