@@ -119,9 +119,9 @@ discard block |
||
119 | 119 | |
120 | 120 | private function deny() { |
121 | 121 | |
122 | - if(!empty($this->excepts)) { |
|
123 | - foreach($this->excepts as $except) { |
|
124 | - if(isset($this->data[$except])) unset($this->data[$except]); |
|
122 | + if (!empty($this->excepts)) { |
|
123 | + foreach ($this->excepts as $except) { |
|
124 | + if (isset($this->data[$except])) unset($this->data[$except]); |
|
125 | 125 | } |
126 | 126 | } |
127 | 127 | |
@@ -132,11 +132,10 @@ discard block |
||
132 | 132 | try { |
133 | 133 | $execute = $this->conn->query("SELECT {$this->params} FROM {$this->table} {$this->where} {$this->order} {$this->limit} {$this->offset}"); |
134 | 134 | $execute->rowCount() > 1 ? |
135 | - $this->data = ($this->type ? $execute->fetchAll(PDO::FETCH_CLASS, static::class) : $execute->fetchAll(PDO::FETCH_ASSOC)) : |
|
136 | - $this->data = ($this->type ? $execute->fetchObject(static::class) : $execute->fetch(PDO::FETCH_ASSOC)); |
|
135 | + $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)); |
|
137 | 136 | self::deny(); |
138 | 137 | return $this->data; |
139 | - } catch(PDOException $exc) { |
|
138 | + } catch (PDOException $exc) { |
|
140 | 139 | return $exc->getMessage(); |
141 | 140 | } |
142 | 141 |
@@ -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 |
@@ -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' => |