1
0

Enable ArrayAccess

This commit is contained in:
Richard Dern 2024-04-17 16:18:27 +02:00
parent c8ccebfebc
commit e4ddff98f1

View File

@ -2,9 +2,10 @@
namespace App\Classes;
use ArrayAccess;
use Illuminate\Filesystem\FilesystemAdapter;
class MetadataManager
class MetadataManager implements ArrayAccess
{
/**
* Original metadata content
@ -65,4 +66,32 @@ public function save(): bool
return true;
}
public function offsetExists(mixed $offset): bool
{
return isset($this->content[$offset]);
}
public function &offsetGet(mixed $offset): mixed
{
if (!isset($this->content[$offset])) {
$this->content[$offset] = null;
}
return $this->content[$offset];
}
public function offsetSet(mixed $offset, mixed $value): void
{
if (is_null($offset)) {
$this->content[] = $value;
} else {
$this->content[$offset] = $value;
}
}
public function offsetUnset(mixed $offset): void
{
unset($this->content[$offset]);
}
}