cookie = $_COOKIE['preferences']; } else { if(setcookie('preferences', 'base_theme', time()+(3600*24)*7)){ $this->cookie = 'base_theme'; } } $this->theme = array( 'base_theme', 'dark_theme', 'pink_theme' ); } public function majCookie(string $maj){ try{ foreach($this->theme as $t){ $this->cookie = $maj; setcookie('preferences', $maj); } } catch (\Exception $e){ throw new \ValueError; } } public function getCookie():string{ return $this->cookie ?? "base_theme"; } } ?>