From dc020a1a3175f9f0e0f60465f56f82a2870c679c Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Sat, 17 Aug 2024 18:16:45 +0400 Subject: [PATCH] modifs.mineures sans commentaires --- wip/php/access/DoubleAccess.php | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/wip/php/access/DoubleAccess.php b/wip/php/access/DoubleAccess.php index 69344af..7c889c7 100644 --- a/wip/php/access/DoubleAccess.php +++ b/wip/php/access/DoubleAccess.php @@ -15,4 +15,37 @@ namespace nur\sery\wip\php\access; * {@link IGetter} attaquent de nouveau $reader comme initialement */ 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; + } }