Exemplo n.º 1
0
 /**
  * Возвращет единственный экземпляр данного класса.
  * @return object - объект класса Storage
  */
 public static function getInstance()
 {
     if (is_null(self::$_instance)) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Exemplo n.º 2
0
 public static function getInstance()
 {
     $mutex = new Mutex('Storage.php');
     if ($mutex->isLocked() == false) {
         $mutex->getLock();
         if (!self::$_instance) {
             self::$_instance = new self();
         }
         $mutex->releaseLock();
     }
     return self::$_instance;
 }