@@ -11,7 +11,7 @@ |
||
| 11 | 11 | /** |
| 12 | 12 | * @method Json_init |
| 13 | 13 | */ |
| 14 | - public function json_init () { |
|
| 14 | + public function json_init() { |
|
| 15 | 15 | (new jsondb())->init(handler::$dbname); |
| 16 | 16 | } |
| 17 | 17 | } |
| 18 | 18 | \ No newline at end of file |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | /** |
| 49 | 49 | * |
| 50 | 50 | */ |
| 51 | - public function __construct (array $settings) { |
|
| 51 | + public function __construct(array $settings) { |
|
| 52 | 52 | if (in_array($settings['type'], self::TYPES)) { |
| 53 | 53 | if ($settings['type'] === 'Mysqli') { |
| 54 | 54 | if (self::CheckParam($settings)) { |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - private static function CheckParam (array $array) { |
|
| 91 | + private static function CheckParam(array $array) { |
|
| 92 | 92 | if (isset($array['username']) && isset($array['dbname']) && isset($array['password'])) { |
| 93 | 93 | self::$host = $array['host'] ?? 'localhost'; |
| 94 | 94 | self::$username = $array['username']; |
@@ -62,13 +62,11 @@ discard block |
||
| 62 | 62 | if ($db) { |
| 63 | 63 | self::$connect = $db; |
| 64 | 64 | print_r($db); |
| 65 | - } |
|
| 66 | - else { |
|
| 65 | + } else { |
|
| 67 | 66 | print self::$username; |
| 68 | 67 | throw new \exception('a problem to connecting'); |
| 69 | 68 | } |
| 70 | - } |
|
| 71 | - else { |
|
| 69 | + } else { |
|
| 72 | 70 | throw new \exception('required parameters not found'); |
| 73 | 71 | } |
| 74 | 72 | } |
@@ -77,13 +75,11 @@ discard block |
||
| 77 | 75 | self::$type = $settings['type']; |
| 78 | 76 | self::$dbname = $settings['dbname']; |
| 79 | 77 | (new database())->json_init(); |
| 80 | - } |
|
| 81 | - else { |
|
| 78 | + } else { |
|
| 82 | 79 | throw new \exception('parameter dbanme not found'); |
| 83 | 80 | } |
| 84 | 81 | } |
| 85 | - } |
|
| 86 | - else { |
|
| 82 | + } else { |
|
| 87 | 83 | throw new \exception('parameter type not found'); |
| 88 | 84 | } |
| 89 | 85 | } |
@@ -96,8 +92,7 @@ discard block |
||
| 96 | 92 | self::$password = $array['password']; |
| 97 | 93 | self::$charset = $array['charset'] ?? 'utf8'; |
| 98 | 94 | return true; |
| 99 | - } |
|
| 100 | - else { |
|
| 95 | + } else { |
|
| 101 | 96 | return false; |
| 102 | 97 | } |
| 103 | 98 | } |