| @@ -150,7 +150,9 @@ | ||
| 150 | 150 |      { | 
| 151 | 151 |          if (!empty($this->excepts)) { | 
| 152 | 152 |              foreach ($this->excepts as $except) { | 
| 153 | - if (isset($this->data[$except])) unset($this->data[$except]); | |
| 153 | +                if (isset($this->data[$except])) { | |
| 154 | + unset($this->data[$except]); | |
| 155 | + } | |
| 154 | 156 | } | 
| 155 | 157 | } | 
| 156 | 158 | } | 
| @@ -83,8 +83,8 @@ discard block | ||
| 83 | 83 | */ | 
| 84 | 84 | public function where(Array $where, String $condition = 'AND'): ?SimplePHP | 
| 85 | 85 |      { | 
| 86 | -        foreach($where as $enclosures) { | |
| 87 | -            $this->where .= $enclosures[0]." ".$enclosures[1]." '".$enclosures[2]."' {$condition} "; | |
| 86 | +        foreach ($where as $enclosures) { | |
| 87 | +            $this->where .= $enclosures[0] . " " . $enclosures[1] . " '" . $enclosures[2] . "' {$condition} "; | |
| 88 | 88 | } | 
| 89 | 89 |          $this->where = "WHERE " . rtrim($this->where, " {$condition} "); | 
| 90 | 90 | |
| @@ -286,7 +286,7 @@ discard block | ||
| 286 | 286 |      { | 
| 287 | 287 | $message = $pdo ? "Error: PDOCode " . $message : $message; | 
| 288 | 288 | $archive = fopen(dirname(__DIR__) . DIRECTORY_SEPARATOR . "Logs" . DIRECTORY_SEPARATOR . "Logs.txt", 'a+'); | 
| 289 | -        fwrite($archive, "-----SimplePHPLog-----\n" . date("d/m/Y H:i:s", time()) . " -> ". $message ."\n-------\n"); | |
| 289 | +        fwrite($archive, "-----SimplePHPLog-----\n" . date("d/m/Y H:i:s", time()) . " -> " . $message . "\n-------\n"); | |
| 290 | 290 | fclose($archive); | 
| 291 | 291 | return null; | 
| 292 | 292 | } | 
| @@ -57,7 +57,7 @@ discard block | ||
| 57 | 57 | $sql->bindParam($data[$i], $values[$i]); | 
| 58 | 58 | } | 
| 59 | 59 | return $sql->execute(); | 
| 60 | -        } catch(PDOException $exception) { | |
| 60 | +        } catch (PDOException $exception) { | |
| 61 | 61 | return $this->writeLog($exception->getCode(), true); | 
| 62 | 62 | } | 
| 63 | 63 | } | 
| @@ -70,20 +70,20 @@ discard block | ||
| 70 | 70 | public function insert(String $params, Array $values) | 
| 71 | 71 |      { | 
| 72 | 72 |          try { | 
| 73 | -            $parameters = "(".$params.")"; | |
| 73 | +            $parameters = "(" . $params . ")"; | |
| 74 | 74 |              $params = explode(',', $params); | 
| 75 | 75 | $data = []; | 
| 76 | 76 | $countParams = count($params); | 
| 77 | -                for($i = 0; $i < $countParams; $i++) { | |
| 78 | - $data[$i] = ":". $params[$i] . $i; | |
| 77 | +                for ($i = 0; $i < $countParams; $i++) { | |
| 78 | + $data[$i] = ":" . $params[$i] . $i; | |
| 79 | 79 | } | 
| 80 | -            $valueBind = "(".implode(', ', $data).")"; | |
| 80 | +            $valueBind = "(" . implode(', ', $data) . ")"; | |
| 81 | 81 |              $sql = $this->conn->prepare("INSERT INTO {$this->table} $parameters VALUES $valueBind"); | 
| 82 | -                for($i = 0; $i < $countParams; $i++) { | |
| 82 | +                for ($i = 0; $i < $countParams; $i++) { | |
| 83 | 83 | $sql->bindParam($data[$i], $values[$i]); | 
| 84 | 84 | } | 
| 85 | 85 | return $sql->execute(); | 
| 86 | -        } catch(PDOException $exception) { | |
| 86 | +        } catch (PDOException $exception) { | |
| 87 | 87 | return $this->writeLog($exception->getCode(), true); | 
| 88 | 88 | } | 
| 89 | 89 | } | 
| @@ -34,7 +34,7 @@ discard block | ||
| 34 | 34 |      { | 
| 35 | 35 | date_default_timezone_set($this->config['timezone']); | 
| 36 | 36 | |
| 37 | -        if(empty($this->conn)) { | |
| 37 | +        if (empty($this->conn)) { | |
| 38 | 38 |              try { | 
| 39 | 39 | $this->conn = new PDO( | 
| 40 | 40 | $this->config['driver'] . ":host=" . | 
| @@ -46,7 +46,7 @@ discard block | ||
| 46 | 46 | $this->config['password'], | 
| 47 | 47 | $this->config['options'] | 
| 48 | 48 | ); | 
| 49 | -            } catch(PDOException $exception) { | |
| 49 | +            } catch (PDOException $exception) { | |
| 50 | 50 | echo json_encode( | 
| 51 | 51 | ['error' => | 
| 52 | 52 | [ | 
| @@ -27,7 +27,7 @@ | ||
| 27 | 27 |          $text = iconv('utf-8', 'us-ascii//TRANSLIT', $text); | 
| 28 | 28 |          $text = preg_replace('~[^-\w]+~', '', trim($text, '-')); | 
| 29 | 29 |          $text = preg_replace('~-+~', '-', strtolower($text)); | 
| 30 | -        if(empty($text)) { return null; } | |
| 30 | +        if (empty($text)) { return null; } | |
| 31 | 31 | return $text; | 
| 32 | 32 | } | 
| 33 | 33 | |