3 namespace Keruald\OmniTools\Collections
;
7 abstract class BaseMap
extends BaseCollection
implements ArrayAccess
{
10 /// Methods to implement
13 public abstract function get (mixed $key) : mixed;
15 public abstract function getOr (mixed $key, mixed $defaultValue): mixed;
17 public abstract function set (mixed $key, mixed $value) : static;
19 public abstract function unset (mixed $key) : static;
21 public abstract function has (mixed $key) : bool;
23 public abstract function contains (mixed $value) : bool;
27 /// Interface to provide accessing objects as arrays.
30 public function offsetExists (mixed $offset) : bool {
31 return $this->has($offset);
34 public function offsetGet (mixed $offset) : mixed {
35 return $this->get($offset);
38 public function offsetSet (mixed $offset, mixed $value) : void
{
39 $this->set($offset, $value);
42 public function offsetUnset (mixed $offset) : void
{
43 $this->unset($offset);