@@ -80,9 +80,13 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | $this->childClass = new ChildSimplePHP(get_called_class()); |
| 82 | 82 | |
| 83 | - if($tableName) $this->table = $tableName; |
|
| 83 | + if($tableName) { |
|
| 84 | + $this->table = $tableName; |
|
| 85 | + } |
|
| 84 | 86 | |
| 85 | - if($primaryKey) $this->primary = $primaryKey; |
|
| 87 | + if($primaryKey) { |
|
| 88 | + $this->primary = $primaryKey; |
|
| 89 | + } |
|
| 86 | 90 | } |
| 87 | 91 | |
| 88 | 92 | private function setRealTable() : ?SimplePHP |
@@ -218,17 +222,21 @@ discard block |
||
| 218 | 222 | */ |
| 219 | 223 | public function __call(String $name, $arguments) |
| 220 | 224 | { |
| 221 | - if($name === 'skip') |
|
| 222 | - return $this->offset($arguments[0]); |
|
| 225 | + if($name === 'skip') { |
|
| 226 | + return $this->offset($arguments[0]); |
|
| 227 | + } |
|
| 223 | 228 | |
| 224 | - if($name === 'take') |
|
| 225 | - return $this->limit($arguments[0]); |
|
| 229 | + if($name === 'take') { |
|
| 230 | + return $this->limit($arguments[0]); |
|
| 231 | + } |
|
| 226 | 232 | |
| 227 | - if($name === 'get') |
|
| 228 | - return $this->execute(); |
|
| 233 | + if($name === 'get') { |
|
| 234 | + return $this->execute(); |
|
| 235 | + } |
|
| 229 | 236 | |
| 230 | - if($name === 'first') |
|
| 231 | - return $this->execute(true); |
|
| 237 | + if($name === 'first') { |
|
| 238 | + return $this->execute(true); |
|
| 239 | + } |
|
| 232 | 240 | |
| 233 | 241 | return $this->writeLog("This method does not exist at the SimplePHP: \"<b>{$name}</b>\"."); |
| 234 | 242 | } |
@@ -250,7 +258,9 @@ discard block |
||
| 250 | 258 | { |
| 251 | 259 | if (!empty($this->excepts)) { |
| 252 | 260 | foreach ($this->excepts as $except) { |
| 253 | - if (isset($this->data[$except])) unset($this->data[$except]); |
|
| 261 | + if (isset($this->data[$except])) { |
|
| 262 | + unset($this->data[$except]); |
|
| 263 | + } |
|
| 254 | 264 | } |
| 255 | 265 | } |
| 256 | 266 | } |
@@ -300,8 +310,9 @@ discard block |
||
| 300 | 310 | { |
| 301 | 311 | $this->type = $type; |
| 302 | 312 | try { |
| 303 | - if(!is_object(Connection::getConnection())) |
|
| 304 | - return $this->writeLog("Connection failed. Check your connection config and try again.", true); |
|
| 313 | + if(!is_object(Connection::getConnection())) { |
|
| 314 | + return $this->writeLog("Connection failed. Check your connection config and try again.", true); |
|
| 315 | + } |
|
| 305 | 316 | |
| 306 | 317 | $execute = Connection::getConnection()->query("SELECT {$this->params} FROM {$this->table} {$this->where} {$this->group} {$this->order} {$this->limit} {$this->offset}"); |
| 307 | 318 | $execute->rowCount() > 1 ? |
@@ -89,8 +89,7 @@ |
||
| 89 | 89 | } else { |
| 90 | 90 | return $_SERVER['HTTP_X_FORWARDED_FOR']; |
| 91 | 91 | } |
| 92 | - } |
|
| 93 | - else { |
|
| 92 | + } else { |
|
| 94 | 93 | return $_SERVER['REMOTE_ADDR']; |
| 95 | 94 | } |
| 96 | 95 | } |