From a65fbf6d87a11db59fa9bff25da0caffafaeb02a Mon Sep 17 00:00:00 2001 From: Jean-Philippe Metivier <jean-philippe.metivier@unicaen.fr> Date: Fri, 26 Jan 2024 10:54:43 +0100 Subject: [PATCH] =?UTF-8?q?Nouvelle=20fonction=20de=20d=C3=A9coupage=20pou?= =?UTF-8?q?r=20les=20t=C3=A9moins?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/UnicaenParametre/Entity/Db/Parametre.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/UnicaenParametre/Entity/Db/Parametre.php b/src/UnicaenParametre/Entity/Db/Parametre.php index 2ca7cc2fd..61822a116 100644 --- a/src/UnicaenParametre/Entity/Db/Parametre.php +++ b/src/UnicaenParametre/Entity/Db/Parametre.php @@ -102,6 +102,18 @@ class Parametre } + public function getTemoins() : array + { + $on = []; + $off = []; + $listing = explode(";", $this->getValeur()); + foreach ($listing as $item) { + if (isset($item[0])) { + if ($item[0] === '!') $off[] = substr($item, 1); else $on[] = $item; + } + } + return [ 'on' => $on, 'off' => $off]; + } } -- GitLab