예제 #1
0
 /**
  * @param Configuration $config
  * @throws MemcacheNotFoundException
  */
 public function __construct(Configuration $config)
 {
     if (!class_exists('Memcache')) {
         throw new MemcacheNotFoundException();
     }
     $memcache = new MemcacheBase();
     // save into object manager
     $objectManager = Safan::handler()->getObjectManager();
     $objectManager->setObject('memcache', $memcache);
     // set hash
     $this->hashKey = $config->getHashKey();
 }
예제 #2
0
 /**
  * Initialize Authentication
  *
  * @param $authParams
  * @throws FileNotFoundException
  */
 public function init($authParams)
 {
     // build config parameters
     $config = new Configuration();
     $config->buildConfig($authParams);
     // check driver
     if (!isset($this->drivers[$authParams['driver']])) {
         throw new FileNotFoundException($authParams['driver']);
     }
     $driverClass = $this->drivers[$authParams['driver']];
     $auth = new $driverClass($config);
     $auth->checkStatus();
     // set to object manager
     $om = Safan::handler()->getObjectManager();
     $om->setObject('authentication', $auth);
 }