modifs.mineures sans commentaires

This commit is contained in:
Jephté Clain 2024-08-17 18:19:15 +04:00
parent dc020a1a31
commit 94e1cb6e0c
2 changed files with 4 additions and 4 deletions

View File

@ -4,10 +4,6 @@ namespace nur\sery\wip\php\access;
use nur\sery\cl; use nur\sery\cl;
abstract class AbstractAccess implements IAccess { abstract class AbstractAccess implements IAccess {
function available(): bool {
return $this->exists() && $this->get() !== false;
}
function inc(): int { function inc(): int {
$value = (int)$this->get(); $value = (int)$this->get();
$this->set(++$value); $this->set(++$value);

View File

@ -23,6 +23,10 @@ class KeyAccess extends AbstractAccess {
return $this->key !== null && cl::has($this->dest, $this->key); return $this->key !== null && cl::has($this->dest, $this->key);
} }
function available(): bool {
return $this->exists() && $this->get() !== false;
}
function get($default=null) { function get($default=null) {
if ($this->key === null) return $default; if ($this->key === null) return $default;
return cl::get($this->dest, $this->key, $default); return cl::get($this->dest, $this->key, $default);