<?php declare(strict_types=1); /* * This file is part of alox bundle for Contao. * * (c) Benjamin Roth * * @license commercial */ namespace vossmedien\AloxBundle\Model; class KatalogModel implements \ArrayAccess, \Countable, \IteratorAggregate { /** * @var int */ private int $TotalItems; /** * @var array */ private array $Items; public function __get($name) { if (isset($this->{$name}) && method_exists($this,'get'.$name)) { return $this->{'get'.$name}(); } } public function getItems(): array { return $this->Items; } public function getTotalItems(): int { return $this->TotalItems; } public function setItems(array $items): void { $this->Items = $items; } public function setTotalItems(int $total): void { $this->TotalItems = $total; } public function getIterator() { return new \ArrayIterator($this->Items); } public function offsetExists($offset) { return isset($this->Items[$offset]); } public function offsetGet($offset) { return $this->Items[$offset]; } public function offsetSet($offset, $value) { throw new \RuntimeException('This collection is immutable'); } public function offsetUnset($offset) { throw new \RuntimeException('This collection is immutable'); } public function count() { return \count($this->Items); } }