Files
2025-08-02 16:30:27 +02:00

39 lines
802 B
PHP

<?php
namespace KupShop\KupShopBundle\Template;
/**
* Class KupshopArrayAccess.
*
* Třída, která umožňuje templatům array access, ale díky tomu že je děděná, reflektuje private proměnné daného objektu
*/
class ArrayAccess implements \ArrayAccess
{
/**
* Implements ArrayAccess interface.
*/
public function offsetSet($offset, $value): void
{
$this->{$offset} = $value;
}
public function offsetExists($offset): bool
{
return isset($this->{$offset});
}
public function offsetUnset($offset): void
{
unset($this->{$offset});
}
public function offsetGet(mixed $offset): mixed
{
if (property_exists($this, $offset)) {
return $this->{$offset};
}
return null;
}
}