access = $access; $this->key = $key; } protected IAccess $access; /** @var int|string|array */ protected $key; function isAllowEmpty(): bool { return $this->access->isAllowEmpty(); } function exists(): bool { $key = $this->key; if ($key === null) return false; if (!$this->access->exists()) return false; return cl::phas($this->access->get(), $key); } function available(): bool { $key = $this->key; if ($key === null) return false; if (!$this->access->available()) return false; $array = $this->access->get(); if (!cl::phas($array, $key)) return false; return $this->isAllowEmpty() || cl::pget($array, $key) !== ""; } function get($default=null) { return cl::pget($this->access->get($default), $this->key); } function set($value): void { $array = $this->access->get(); cl::pset($array, $this->key, $value); $this->access->set($array); } function del(): void { $array = $this->access->get(); cl::pdel($array, $this->key); $this->access->set($array); } function addKey($key): IAccess { return new ChainKeyAccess($this->access, cl::merge($this->key, $key)); } }