public function __construct($connection = null)
 {
     if ($connection instanceof \PDO) {
         $this->db = $connection;
     } else {
         $this->db = App::getInstance()->getDbConnection($connection);
     }
 }
 public function setIdentityModel()
 {
     $ns = App::getInstance()->getConfig()->app['namespaces']['identity'];
     $model = App::getInstance()->getConfig()->app['identity_model'];
     if ($ns && $model) {
         $path = $ns . '\\' . $model;
         $f = realpath($path . '.php');
         if ($f && is_file($f) && is_readable($f)) {
             $this->identityModel = $path;
         }
     }
     if ($this->identityModel == null) {
         $this->identityModel = 'IdentityUser';
     }
 }
 private function getDefaultMethod()
 {
     $method = App::getInstance()->getConfig()->app['default_method'];
     if ($method) {
         return $method;
     } else {
         return 'index';
     }
 }
 protected function __construct()
 {
     $this->db = new DefaultDatabase('default');
     $this->dbname = App::getInstance()->getConfig()->db['default']['dbname'];
 }