From a5d1485ecf54d1609729eec85fd28ea33225d758 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Thu, 28 Dec 2023 19:33:05 +0400 Subject: [PATCH] modifs.mineures sans commentaires --- php/src_base/AccessException.php | 9 ++++++++- php/src_base/StateException.php | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/php/src_base/AccessException.php b/php/src_base/AccessException.php index 0fe1c6d..13a4d4a 100644 --- a/php/src_base/AccessException.php +++ b/php/src_base/AccessException.php @@ -7,7 +7,14 @@ use Exception; * Class AccessException: indiquer que la resource ou l'objet auquel on veut * accéder n'est pas accessible. il s'agit donc d'une erreur de l'utilisateur */ -class AccessException extends Exception { +class AccessException extends UserException { + static final function read_only(?string $dest=null, ?string $prefix=null): self { + if ($prefix) $prefix = "$prefix: "; + if ($dest === null) $dest = "this property"; + $message = "$dest is read-only"; + return new static($prefix.$message); + } + static final function immutable_object(?string $dest=null, ?string $prefix=null): self { if ($prefix) $prefix = "$prefix: "; if ($dest === null) $dest = "this object"; diff --git a/php/src_base/StateException.php b/php/src_base/StateException.php index 8cc3d05..b54d13a 100644 --- a/php/src_base/StateException.php +++ b/php/src_base/StateException.php @@ -1,13 +1,13 @@