コード例 #1
0
 /**
  * Point d'accès à l'instance unique.
  * L'instance est créée au premier appel et réutilisée aux appels suivants.
  * @throws Exception si la configuration n'a pas été effectuée.
  *
  * @return myPDO instance unique
  */
 public static function getInstance()
 {
     if (is_null(self::$_PDOInstance)) {
         if (self::hasConfiguration()) {
             self::$_PDOInstance = new PDO(self::$_DSN, self::$_username, self::$_password, self::$_driverOptions);
         } else {
             throw new Exception(__CLASS__ . ": Configuration not set");
         }
     }
     return self::$_PDOInstance;
 }