27 $json = file_get_contents(__DIR__ .
"/../config/config.json");
28 $this->config = json_decode($json,
true);
29 }
catch (Exception $e) {
30 die(
'Récupération du fichier de configuration échouer: ' . $e->getMessage());
40 if (self::$instance ==
null) {
66 throw new Exception(
"Un singleton ne doit pas être deserialisé.");
__clone()
Empêche le clonage du singleton.
getConfig()
Retourne le tableau de configuration complet.
__construct()
Constructeur privé pour empêcher l'instanciation directe.
static getInstance()
Retourne l'instance unique de la classe Constantes (pattern Singleton).
__wakeup()
Empêche la désérialisation du singleton.
static Constantes $instance