Exemplo n.º 1
0
 /**
  * Get instance
  *
  * @return object
  */
 public static function getInstance()
 {
     $className = 'Codersquad\\Pestophp\\Database\\Types\\' . String::upperFirst(strtolower(DatabaseConfiguration::get('type')));
     /** @var $className Database */
     $instance = $className::getInstance();
     $instance->connect();
     return $instance;
 }
Exemplo n.º 2
0
 /**
  * Initialize configuraiton
  *
  * @return void
  */
 private function initConfiguration()
 {
     $configurationCommand = new Command();
     /** @noinspection PhpParamsInspection */
     $configurationCommand->add(DatabaseConfiguration::getInstance());
     $configurationCommand->add(PathConfiguration::getInstance());
     $configurationCommand->run();
 }
Exemplo n.º 3
0
 /**
  * Connect to database
  *
  * @return Mysql
  */
 public function connect()
 {
     if (null === $this->connection) {
         $this->connection = mysqli_connect(DatabaseConfiguration::get('host'), DatabaseConfiguration::get('user'), DatabaseConfiguration::get('password'), DatabaseConfiguration::get('database'), null, DatabaseConfiguration::get('socket'));
     }
 }