@@ -121,7 +121,9 @@ |
||
| 121 | 121 | |
| 122 | 122 | if(!empty($this->excepts)) { |
| 123 | 123 | foreach($this->excepts as $except) { |
| 124 | - if(isset($this->data[$except])) unset($this->data[$except]); |
|
| 124 | + if(isset($this->data[$except])) { |
|
| 125 | + unset($this->data[$except]); |
|
| 126 | + } |
|
| 125 | 127 | } |
| 126 | 128 | } |
| 127 | 129 | |
@@ -160,9 +160,9 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | private function deny() { |
| 162 | 162 | |
| 163 | - if(!empty($this->excepts)) { |
|
| 164 | - foreach($this->excepts as $except) { |
|
| 165 | - if(isset($this->data[$except])) unset($this->data[$except]); |
|
| 163 | + if (!empty($this->excepts)) { |
|
| 164 | + foreach ($this->excepts as $except) { |
|
| 165 | + if (isset($this->data[$except])) unset($this->data[$except]); |
|
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | |
@@ -176,11 +176,10 @@ discard block |
||
| 176 | 176 | try { |
| 177 | 177 | $execute = $this->conn->query("SELECT {$this->params} FROM {$this->table} {$this->where} {$this->order} {$this->limit} {$this->offset}"); |
| 178 | 178 | $execute->rowCount() > 1 ? |
| 179 | - $this->data = ($this->type ? $execute->fetchAll(PDO::FETCH_CLASS, static::class) : $execute->fetchAll(PDO::FETCH_ASSOC)) : |
|
| 180 | - $this->data = ($this->type ? $execute->fetchObject(static::class) : $execute->fetch(PDO::FETCH_ASSOC)); |
|
| 179 | + $this->data = ($this->type ? $execute->fetchAll(PDO::FETCH_CLASS, static::class) : $execute->fetchAll(PDO::FETCH_ASSOC)) : $this->data = ($this->type ? $execute->fetchObject(static::class) : $execute->fetch(PDO::FETCH_ASSOC)); |
|
| 181 | 180 | self::deny(); |
| 182 | 181 | return $this->data; |
| 183 | - } catch(PDOException $exc) { |
|
| 182 | + } catch (PDOException $exc) { |
|
| 184 | 183 | return $exc->getMessage(); |
| 185 | 184 | } |
| 186 | 185 | |
@@ -9,15 +9,15 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | public function update($table, String $params, Array $values, $where) { |
| 11 | 11 | |
| 12 | - $where = $where != '' ? $where = "WHERE ".$where : $where = ''; |
|
| 12 | + $where = $where != '' ? $where = "WHERE " . $where : $where = ''; |
|
| 13 | 13 | |
| 14 | 14 | $params = explode(', ', $params); |
| 15 | 15 | |
| 16 | 16 | $data = []; |
| 17 | 17 | |
| 18 | - for($i = 0; $i < count($params); $i++) { |
|
| 18 | + for ($i = 0; $i < count($params); $i++) { |
|
| 19 | 19 | |
| 20 | - $data[$i] = ":".$params[$i][0].$params[$i][1].$params[$i][2].", "; |
|
| 20 | + $data[$i] = ":" . $params[$i][0] . $params[$i][1] . $params[$i][2] . ", "; |
|
| 21 | 21 | |
| 22 | 22 | } |
| 23 | 23 | |
@@ -25,9 +25,9 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | $final = array_map(null, $params, $data); |
| 27 | 27 | |
| 28 | - foreach($final as $key => $vals) { |
|
| 28 | + foreach ($final as $key => $vals) { |
|
| 29 | 29 | |
| 30 | - foreach($vals as $chave => $val) { |
|
| 30 | + foreach ($vals as $chave => $val) { |
|
| 31 | 31 | |
| 32 | 32 | $result .= str_replace(':', ' = :', $val); |
| 33 | 33 | |
@@ -39,25 +39,25 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | $sql = $this->conn->prepare("UPDATE $table SET $result $where"); |
| 41 | 41 | |
| 42 | - for($i = 0; $i < count($params); $i++) { |
|
| 42 | + for ($i = 0; $i < count($params); $i++) { |
|
| 43 | 43 | |
| 44 | - $data[$i] = ":".$params[$i][0].$params[$i][1].$params[$i][2]; |
|
| 44 | + $data[$i] = ":" . $params[$i][0] . $params[$i][1] . $params[$i][2]; |
|
| 45 | 45 | |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - for($i = 0; $i < count($data); $i++) { |
|
| 48 | + for ($i = 0; $i < count($data); $i++) { |
|
| 49 | 49 | |
| 50 | 50 | $sql->bindParam($data[$i], $values[$i]); |
| 51 | 51 | |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - if($sql->execute()) { |
|
| 54 | + if ($sql->execute()) { |
|
| 55 | 55 | |
| 56 | 56 | return true; |
| 57 | 57 | |
| 58 | 58 | } else { |
| 59 | 59 | |
| 60 | - echo "Erro:". $sql->errorInfo(); |
|
| 60 | + echo "Erro:" . $sql->errorInfo(); |
|
| 61 | 61 | |
| 62 | 62 | } |
| 63 | 63 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public function PDO() { |
| 34 | 34 | |
| 35 | - if(empty($this->conn)) { |
|
| 35 | + if (empty($this->conn)) { |
|
| 36 | 36 | |
| 37 | 37 | try { |
| 38 | 38 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $this->config['options'] |
| 48 | 48 | ); |
| 49 | 49 | |
| 50 | - } catch(PDOException $exception) { |
|
| 50 | + } catch (PDOException $exception) { |
|
| 51 | 51 | |
| 52 | 52 | echo json_encode( |
| 53 | 53 | ['error' => |