@@ -17,12 +17,12 @@ |
||
17 | 17 | /** |
18 | 18 | * @const types database |
19 | 19 | */ |
20 | - const TYPES = array('Mysqli','Medoo','Json'); |
|
20 | + const TYPES = array('Mysqli', 'Medoo', 'Json'); |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * @const Medoo database types |
24 | 24 | */ |
25 | - const Medoo_Types = array('mysql','mariadb','pgsql','sybase','oracle','mssql', 'sqlite'); |
|
25 | + const Medoo_Types = array('mysql', 'mariadb', 'pgsql', 'sybase', 'oracle', 'mssql', 'sqlite'); |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * @var type database |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | */ |
18 | 18 | public function __construct(array $settings) |
19 | 19 | { |
20 | - if(in_array($settings['type'],self::TYPES)){ |
|
21 | - if($settings['type'] === 'Mysqli'){ |
|
22 | - if(self::CheckParam($settings)){ |
|
20 | + if (in_array($settings['type'], self::TYPES)) { |
|
21 | + if ($settings['type'] === 'Mysqli') { |
|
22 | + if (self::CheckParam($settings)) { |
|
23 | 23 | $db = new Mysqlidb([ |
24 | 24 | 'host' => $this->host, |
25 | 25 | 'username' => $this->username, |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | 'db' => $this->dbname, |
28 | 28 | 'charset' => $this->charset |
29 | 29 | ]); |
30 | - if($db){ |
|
30 | + if ($db) { |
|
31 | 31 | $this->connect = $db; |
32 | 32 | } else { |
33 | 33 | throw new \exception('a problem to connecting'); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | throw new \exception('required parameters not found'); |
37 | 37 | } |
38 | 38 | } |
39 | - if($settings['type'] === 'Json' and isset($settings['dbname'])){ |
|
39 | + if ($settings['type'] === 'Json' and isset($settings['dbname'])) { |
|
40 | 40 | $this->type = $settings['type']; |
41 | 41 | $this->dbname = $settings['dbname']; |
42 | 42 | parent::Json_init(); |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
51 | - private static function CheckParam(array $array){ |
|
52 | - if(isset($array['username']) && isset($array['dbname']) && isset($array['password'])){ |
|
51 | + private static function CheckParam(array $array) { |
|
52 | + if (isset($array['username']) && isset($array['dbname']) && isset($array['password'])) { |
|
53 | 53 | $this->host = $array['host'] ?? 'localhost'; |
54 | 54 | $this->username = $array['username']; |
55 | 55 | $this->dbname = $array['dbname']; |