@@ -1,26 +1,26 @@ discard block  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | 2 | |
| 3 | - //define namespace  | 
                                                        |
| 4 | - namespace BPT;  | 
                                                        |
| 3 | + //define namespace  | 
                                                        |
| 4 | + namespace BPT;  | 
                                                        |
| 5 | 5 | |
| 6 | - //use class  | 
                                                        |
| 7 | - use BPT\database;  | 
                                                        |
| 6 | + //use class  | 
                                                        |
| 7 | + use BPT\database;  | 
                                                        |
| 8 | 8 | |
| 9 | - /**  | 
                                                        |
| 10 | - *  | 
                                                        |
| 11 | - */  | 
                                                        |
| 12 | - class handller extends database  | 
                                                        |
| 13 | -  { | 
                                                        |
| 9 | + /**  | 
                                                        |
| 10 | + *  | 
                                                        |
| 11 | + */  | 
                                                        |
| 12 | + class handller extends database  | 
                                                        |
| 13 | +    { | 
                                                        |
| 14 | 14 | |
| 15 | - /**  | 
                                                        |
| 16 | - *  | 
                                                        |
| 17 | - */  | 
                                                        |
| 18 | - public function __construct(array $settings)  | 
                                                        |
| 19 | -      { | 
                                                        |
| 15 | + /**  | 
                                                        |
| 16 | + *  | 
                                                        |
| 17 | + */  | 
                                                        |
| 18 | + public function __construct(array $settings)  | 
                                                        |
| 19 | +        { | 
                                                        |
| 20 | 20 |          if(in_array($settings['type'],self::TYPES)){ | 
                                                        
| 21 | -              if($settings['type'] === 'Mysqli'){ | 
                                                        |
| 22 | -                  if(self::CheckParam($settings)){ | 
                                                        |
| 23 | - $db = new Mysqlidb([  | 
                                                        |
| 21 | +                if($settings['type'] === 'Mysqli'){ | 
                                                        |
| 22 | +                    if(self::CheckParam($settings)){ | 
                                                        |
| 23 | + $db = new Mysqlidb([  | 
                                                        |
| 24 | 24 | 'host' => $this->host,  | 
                                                        
| 25 | 25 | 'username' => $this->username,  | 
                                                        
| 26 | 26 | 'password' => $this->password,  | 
                                                        
@@ -28,36 +28,36 @@ discard block  | 
                                                    ||
| 28 | 28 | 'charset' => $this->charset  | 
                                                        
| 29 | 29 | ]);  | 
                                                        
| 30 | 30 |                  if($db){ | 
                                                        
| 31 | - $this->connect = $db;  | 
                                                        |
| 32 | -               } else { | 
                                                        |
| 33 | -                  throw new \exception('a problem to connecting'); | 
                                                        |
| 34 | - }  | 
                                                        |
| 35 | -               } else { | 
                                                        |
| 36 | -                  throw new \exception('required parameters not found'); | 
                                                        |
| 37 | - }  | 
                                                        |
| 38 | - }  | 
                                                        |
| 39 | -              if($settings['type'] === 'Json' and isset($settings['dbname'])){ | 
                                                        |
| 31 | + $this->connect = $db;  | 
                                                        |
| 32 | +                } else { | 
                                                        |
| 33 | +                    throw new \exception('a problem to connecting'); | 
                                                        |
| 34 | + }  | 
                                                        |
| 35 | +                } else { | 
                                                        |
| 36 | +                    throw new \exception('required parameters not found'); | 
                                                        |
| 37 | + }  | 
                                                        |
| 38 | + }  | 
                                                        |
| 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();  | 
                                                        
| 43 | -              } else { | 
                                                        |
| 43 | +                } else { | 
                                                        |
| 44 | 44 |                  throw new \exception('parameter dbanme not found'); | 
                                                        
| 45 | - }  | 
                                                        |
| 46 | -          } else { | 
                                                        |
| 47 | -              throw new \exception('parameter type not found'); | 
                                                        |
| 48 | - }  | 
                                                        |
| 49 | - }  | 
                                                        |
| 45 | + }  | 
                                                        |
| 46 | +            } else { | 
                                                        |
| 47 | +                throw new \exception('parameter type not found'); | 
                                                        |
| 48 | + }  | 
                                                        |
| 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'];  | 
                                                        
| 56 | 56 | $this->password = $array['password'];  | 
                                                        
| 57 | 57 | $this->charset = $array['charset'] ?? 'utf8mb4';  | 
                                                        
| 58 | - return true;  | 
                                                        |
| 59 | -         } else { | 
                                                        |
| 60 | - return false;  | 
                                                        |
| 61 | - }  | 
                                                        |
| 62 | - }  | 
                                                        |
| 63 | - }  | 
                                                        |
| 64 | 58 | \ No newline at end of file  | 
                                                        
| 59 | + return true;  | 
                                                        |
| 60 | +            } else { | 
                                                        |
| 61 | + return false;  | 
                                                        |
| 62 | + }  | 
                                                        |
| 63 | + }  | 
                                                        |
| 64 | + }  | 
                                                        |
| 65 | 65 | \ No newline at end of file  |