@@ -12,12 +12,12 @@ discard block |
||
| 12 | 12 | /** |
| 13 | 13 | * @const types database |
| 14 | 14 | */ |
| 15 | - const TYPES = array('Mysqli','Medoo','Json'); |
|
| 15 | + const TYPES = array('Mysqli', 'Medoo', 'Json'); |
|
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * @const Medoo database types |
| 19 | 19 | */ |
| 20 | - const Medoo_Types = array('mysql','mariadb','pgsql','sybase','oracle','mssql', 'sqlite'); |
|
| 20 | + const Medoo_Types = array('mysql', 'mariadb', 'pgsql', 'sybase', 'oracle', 'mssql', 'sqlite'); |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * @var type database |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | public function __construct(array $settings) |
| 62 | 62 | { |
| 63 | - if(in_array($settings['type'],self::TYPES)){ |
|
| 64 | - if($settings['type'] === 'Mysqli'){ |
|
| 65 | - if(self::CheckParam($settings)){ |
|
| 63 | + if (in_array($settings['type'], self::TYPES)) { |
|
| 64 | + if ($settings['type'] === 'Mysqli') { |
|
| 65 | + if (self::CheckParam($settings)) { |
|
| 66 | 66 | $db = new \Mysqlidb([ |
| 67 | 67 | 'host' => self::$host, |
| 68 | 68 | 'username' => self::$username, |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | 'db' => self::$dbname, |
| 71 | 71 | 'charset' => self::$charset |
| 72 | 72 | ]); |
| 73 | - if($db){ |
|
| 73 | + if ($db) { |
|
| 74 | 74 | self::$connect = $db; |
| 75 | 75 | print_r($db); |
| 76 | 76 | } else { |
@@ -81,8 +81,8 @@ discard block |
||
| 81 | 81 | throw new \exception('required parameters not found'); |
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | - if($settings['type'] === 'Json'){ |
|
| 85 | - if(isset($settings['dbname'])){ |
|
| 84 | + if ($settings['type'] === 'Json') { |
|
| 85 | + if (isset($settings['dbname'])) { |
|
| 86 | 86 | self::$type = $settings['type']; |
| 87 | 87 | self::$dbname = $settings['dbname']; |
| 88 | 88 | (new database())->json_init(); |
@@ -95,8 +95,8 @@ discard block |
||
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - private static function CheckParam(array $array){ |
|
| 99 | - if(isset($array['username']) && isset($array['dbname']) && isset($array['password'])){ |
|
| 98 | + private static function CheckParam(array $array) { |
|
| 99 | + if (isset($array['username']) && isset($array['dbname']) && isset($array['password'])) { |
|
| 100 | 100 | self::$host = $array['host'] ?? 'localhost'; |
| 101 | 101 | self::$username = $array['username']; |
| 102 | 102 | self::$dbname = $array['dbname']; |