From f60a9d046088b3bad3e97ff568fc83fecc67ccde Mon Sep 17 00:00:00 2001 From: polo Date: Thu, 26 Jun 2025 11:11:24 +0200 Subject: =?UTF-8?q?ajout=20dans=20css=5Farray=20=C3=A0=20la=20cr=C3=A9atio?= =?UTF-8?q?n=20d'un=20bloc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/model/entities/Node.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/model/entities') diff --git a/src/model/entities/Node.php b/src/model/entities/Node.php index 711eb3e..c4d0830 100644 --- a/src/model/entities/Node.php +++ b/src/model/entities/Node.php @@ -98,13 +98,15 @@ class Node { $this->attributes = self::$default_attributes; } - /*public function addAttribute(string $key, string $value): void + public function addAttribute(string $key, string $value): void { if(!isset($this->attributes[$key])) { // sécurité $key inexistante $this->attributes[$key] = []; } - $this->attributes[$key][] = $value; - }*/ + if(!in_array($value, $this->attributes[$key])){ + $this->attributes[$key][] = $value; + } + } /*public function removeAttribute(string $key, string $value): void { if(isset($this->attributes[$key])) // sécurité $key inexistante -- cgit v1.2.3