aboutsummaryrefslogtreecommitdiff
path: root/lib/classes/sidebar/AttributesArrayAccessTrait.php
blob: 09fc03008f5084d405085b972f99b8063b20465c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
trait AttributesArrayAccessTrait
{
    public $attributes = [];

    public function offsetExists($offset): bool
    {
        return isset($this->attributes[$offset]);
    }

    /**
     * @param string $offset
     */
    public function offsetGet($offset): mixed
    {
        return $this->attributes[$offset];
    }

    public function offsetSet($offset, $value): void
    {
        $this->attributes[$offset] = $value;
    }

    public function offsetUnset($offset): void
    {
        unset($this->attributes[$offset]);
    }
}