mirror of
https://github.com/peklaiho/madlisp.git
synced 2024-11-26 07:04:27 +00:00
28 lines
447 B
PHP
28 lines
447 B
PHP
<?php
|
|
namespace MadLisp;
|
|
|
|
abstract class Collection
|
|
{
|
|
protected array $data = [];
|
|
|
|
public function __construct(array $data = [])
|
|
{
|
|
$this->data = $data;
|
|
}
|
|
|
|
public function count(): int
|
|
{
|
|
return count($this->data);
|
|
}
|
|
|
|
public function has(string $key): bool
|
|
{
|
|
return array_key_exists($key, $this->data);
|
|
}
|
|
|
|
public function getData(): array
|
|
{
|
|
return $this->data;
|
|
}
|
|
}
|