public static function getControllerFromSession($class)
 {
     if (ClassUtils::isClass($class, AbstractController::class) && !empty($modelClass = call_user_func($class . '::getModelClass')) && Session::exists($class)) {
         $array = [];
         $vars = get_class_vars($modelClass);
         foreach ($vars as $var => $ignored) {
             if (Session::exists($var)) {
                 $array[$var] = Session::get($var);
             }
         }
         return self::getControllerFromArray($class, $modelClass, $array);
     }
     return false;
 }
Exemplo n.º 2
0
 /**
  * @return AbstractDatabase
  */
 public static function getInstance()
 {
     if (isset(self::$instance)) {
         return self::$instance;
     } else {
         $databaseType = strtolower(Config::get('database', 'type'));
         if (array_key_exists($databaseType, self::$databaseMappings)) {
             if (ClassUtils::isClass($databaseClass = self::$databaseMappings[$databaseType], AbstractDatabase::class)) {
                 return new $databaseClass(Config::get('database', 'host'), Config::get('database', 'port'), Config::get('database', 'name'), Config::get('database', 'user'), Config::get('database', 'pass'));
             }
         }
         die('Unknown database type');
     }
 }