Authsome::instance PHP Метод

instance() статический публичный Метод

static public instance ( $setInstance = null )
    static function instance($setInstance = null)
    {
        static $instance;
        if ($setInstance) {
            $instance = $setInstance;
        }
        if (!$instance) {
            throw new Exception('AuthsomeComponent not initialized properly!');
        }
        return $instance;
    }

Usage Example

Пример #1
0
 public function initialize($controller, $settings = array())
 {
     Authsome::instance($this);
     $this->settings = Set::merge($this->settings, $settings);
     // Use the model name as the key everywhere by default
     $keys = array('configure', 'session', 'cookie');
     foreach ($keys as $prefix) {
         $key = $prefix . 'Key';
         if (empty($this->settings[$key])) {
             $this->settings[$key] = $this->settings['model'];
         }
     }
 }