@@ -92,9 +92,9 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function where(Array $where, String $condition = 'AND'): ?SimplePHP |
| 94 | 94 | { |
| 95 | - foreach($where as $enclosures) { |
|
| 96 | - $split = isset($enclosures[3]) && !$enclosures[3] ? $enclosures[2] : "'".$enclosures[2]."'"; |
|
| 97 | - $this->where .= $enclosures[0]." ".$enclosures[1]." ".$split." {$condition} "; |
|
| 95 | + foreach ($where as $enclosures) { |
|
| 96 | + $split = isset($enclosures[3]) && !$enclosures[3] ? $enclosures[2] : "'" . $enclosures[2] . "'"; |
|
| 97 | + $this->where .= $enclosures[0] . " " . $enclosures[1] . " " . $split . " {$condition} "; |
|
| 98 | 98 | } |
| 99 | 99 | $this->where = "WHERE " . rtrim($this->where, " {$condition} "); |
| 100 | 100 | |
@@ -119,9 +119,9 @@ discard block |
||
| 119 | 119 | public function orWhere(Array $orWhere, String $condition = 'AND'): ?SimplePHP |
| 120 | 120 | { |
| 121 | 121 | $moreWhere = ''; |
| 122 | - foreach($orWhere as $enclosures) { |
|
| 123 | - $split = isset($enclosures[3]) && !$enclosures[3] ? $enclosures[2] : "'".$enclosures[2]."'"; |
|
| 124 | - $moreWhere .= $enclosures[0]." ".$enclosures[1]." ".$split." {$condition} "; |
|
| 122 | + foreach ($orWhere as $enclosures) { |
|
| 123 | + $split = isset($enclosures[3]) && !$enclosures[3] ? $enclosures[2] : "'" . $enclosures[2] . "'"; |
|
| 124 | + $moreWhere .= $enclosures[0] . " " . $enclosures[1] . " " . $split . " {$condition} "; |
|
| 125 | 125 | } |
| 126 | 126 | $this->where .= " OR " . rtrim($moreWhere, " {$condition} "); |
| 127 | 127 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | public function orderBy(String $prop, String $ordenation = 'ASC'): ?SimplePHP |
| 167 | 167 | { |
| 168 | - if(mb_strlen($this->order) < 9) { |
|
| 168 | + if (mb_strlen($this->order) < 9) { |
|
| 169 | 169 | $this->order = "ORDER BY {$prop} {$ordenation}"; |
| 170 | 170 | } else { |
| 171 | 171 | $this->order .= ", {$prop} {$ordenation}"; |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | */ |
| 180 | 180 | public function groupBy(String $prop): ?SimplePHP |
| 181 | 181 | { |
| 182 | - if(mb_strlen($this->group) < 9) { |
|
| 182 | + if (mb_strlen($this->group) < 9) { |
|
| 183 | 183 | $this->group = "GROUP BY {$prop}"; |
| 184 | 184 | } else { |
| 185 | 185 | $this->group .= ", {$prop}"; |
@@ -194,10 +194,10 @@ discard block |
||
| 194 | 194 | */ |
| 195 | 195 | public function __call(String $name, $arguments) : ?SimplePHP |
| 196 | 196 | { |
| 197 | - if($name === 'skip') |
|
| 197 | + if ($name === 'skip') |
|
| 198 | 198 | return $this->offset($arguments[0]); |
| 199 | 199 | |
| 200 | - if($name === 'take') |
|
| 200 | + if ($name === 'take') |
|
| 201 | 201 | return $this->limit($arguments[0]); |
| 202 | 202 | |
| 203 | 203 | $this->writeLog("This method does not exist at the SimplePHP: \"<b>{$name}</b>\"."); |
@@ -194,11 +194,13 @@ discard block |
||
| 194 | 194 | */ |
| 195 | 195 | public function __call(String $name, $arguments) : ?SimplePHP |
| 196 | 196 | { |
| 197 | - if($name === 'skip') |
|
| 198 | - return $this->offset($arguments[0]); |
|
| 197 | + if($name === 'skip') { |
|
| 198 | + return $this->offset($arguments[0]); |
|
| 199 | + } |
|
| 199 | 200 | |
| 200 | - if($name === 'take') |
|
| 201 | - return $this->limit($arguments[0]); |
|
| 201 | + if($name === 'take') { |
|
| 202 | + return $this->limit($arguments[0]); |
|
| 203 | + } |
|
| 202 | 204 | |
| 203 | 205 | $this->writeLog("This method does not exist at the SimplePHP: \"<b>{$name}</b>\"."); |
| 204 | 206 | return null; |
@@ -221,7 +223,9 @@ discard block |
||
| 221 | 223 | { |
| 222 | 224 | if (!empty($this->excepts)) { |
| 223 | 225 | foreach ($this->excepts as $except) { |
| 224 | - if (isset($this->data[$except])) unset($this->data[$except]); |
|
| 226 | + if (isset($this->data[$except])) { |
|
| 227 | + unset($this->data[$except]); |
|
| 228 | + } |
|
| 225 | 229 | } |
| 226 | 230 | } |
| 227 | 231 | } |