/** * @return App_Auth */ public static function getInstance() { if (!self::$_instance) { self::$_instance = new self(); } return self::$_instance; }
public function getInstance() { if (null === self::$_instance) { self::$_instance = new self(); if (!empty($_SESSION['user'])) { $strUserCls = self::getUserClass(); self::$_instance->_objUser = $strUserCls::fetchById($_SESSION['user']); } } return self::$_instance; }
/** * Returns an instance of Zend_Auth * * Singleton pattern implementation * * @return Zend_Auth Provides a fluent interface */ public static function getInstance() { if (null === self::$_instance) { self::$_instance = new self(); } // self::$_instance = new self(); try { if (!Zend_Session::isStarted()) { Zend_Session::start(); } } catch (Zend_Session_Exception $e) { echo $e->getFile(); echo $e->getMessage(); echo $e->getTrace(); } self::$_session_id = session_id(); return self::$_instance; }
/** * Set the default registry instance to a specified instance. * * @param Registry $registry An object instance of type Registry, * or a subclass. * @return void * @throws App_Exception if registry is already initialized. */ public static function setInstance(App_Auth $oAuth) { if (self::$_instance !== null) { throw new App_Exception('Auth is already initialized'); } self::$_instance = $oAuth; }