Enable ArrayAccess
This commit is contained in:
parent
c8ccebfebc
commit
e4ddff98f1
|
@ -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]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user