modifs.mineures sans commentaires

This commit is contained in:
Jephté Clain 2024-08-17 18:16:45 +04:00
parent 3759f10fa0
commit dc020a1a31
1 changed files with 33 additions and 0 deletions

View File

@ -15,4 +15,37 @@ namespace nur\sery\wip\php\access;
* {@link IGetter} attaquent de nouveau $reader comme initialement * {@link IGetter} attaquent de nouveau $reader comme initialement
*/ */
class DoubleAccess extends AbstractAccess { class DoubleAccess extends AbstractAccess {
function __construct(IAccess $reader, IAccess $writer) {
$this->reader = $reader;
$this->writer = $writer;
$this->getter = $reader;
}
protected IAccess $reader;
protected IAccess $writer;
protected IGetter $getter;
function exists(): bool {
return $this->getter->exists();
}
function available(): bool {
return $this->getter->available();
}
function get($default=null) {
return $this->getter->get($default);
}
function set($value): void {
$this->writer->set($value);
$this->getter = $this->writer;
}
public function del(): void {
$this->writer->del();
$this->getter = $this->reader;
}
} }