@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | private function getInstance(): ?PDO |
36 | 36 | { |
37 | - if (strpos($_SERVER['SERVER_NAME'], "homologacao") && !strpos($this->database, "Homologacao") ) |
|
37 | + if (strpos($_SERVER['SERVER_NAME'], "homologacao") && !strpos($this->database, "Homologacao")) |
|
38 | 38 | $this->database .= "Homologacao"; |
39 | 39 | |
40 | 40 | if (!isset($this->instance)) { |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $this->prepare->execute($params); |
59 | 59 | $this->setLogSQL($query, $params); |
60 | 60 | } catch (PDOException $e) { |
61 | - Connect::setError($e,$query); |
|
61 | + Connect::setError($e, $query); |
|
62 | 62 | return false; |
63 | 63 | } |
64 | 64 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @param $prepare |
70 | 70 | * @return int |
71 | 71 | */ |
72 | - protected function count($prepare=null): int |
|
72 | + protected function count($prepare = null): int |
|
73 | 73 | { |
74 | 74 | try { |
75 | 75 | $prepare = empty($prepare) ? $this->prepare : $prepare; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @param $prepare |
88 | 88 | * @return array|false |
89 | 89 | */ |
90 | - protected function fetchArrayAssoc($prepare=null): array |
|
90 | + protected function fetchArrayAssoc($prepare = null): array |
|
91 | 91 | { |
92 | 92 | try { |
93 | 93 | $prepare = empty($prepare) ? $this->prepare : $prepare; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @param $prepare |
105 | 105 | * @return array|false |
106 | 106 | */ |
107 | - protected function fetchArrayObj($prepare=null): array |
|
107 | + protected function fetchArrayObj($prepare = null): array |
|
108 | 108 | { |
109 | 109 | try { |
110 | 110 | $prepare = empty($prepare) ? $this->prepare : $prepare; |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * @param String|null $class |
123 | 123 | * @return array|false |
124 | 124 | */ |
125 | - protected function fetchArrayClass($prepare=null, String $class=null): array |
|
125 | + protected function fetchArrayClass($prepare = null, String $class = null): array |
|
126 | 126 | { |
127 | 127 | try { |
128 | 128 | $prepare = empty($prepare) ? $this->prepare : $prepare; |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @param $prepare |
141 | 141 | * @return array|false |
142 | 142 | */ |
143 | - protected function fetchOneAssoc($prepare=null): array |
|
143 | + protected function fetchOneAssoc($prepare = null): array |
|
144 | 144 | { |
145 | 145 | try { |
146 | 146 | $prepare = empty($prepare) ? $this->prepare : $prepare; |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * @param $prepare |
157 | 157 | * @return stdClass|false |
158 | 158 | */ |
159 | - protected function fetchOneObj($prepare=null): stdClass |
|
159 | + protected function fetchOneObj($prepare = null): stdClass |
|
160 | 160 | { |
161 | 161 | try { |
162 | 162 | $prepare = empty($prepare) ? $this->prepare : $prepare; |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * @param String|null $class |
174 | 174 | * @return array|false |
175 | 175 | */ |
176 | - protected function fetchOneClass($prepare=null, String $class=null): object |
|
176 | + protected function fetchOneClass($prepare = null, String $class = null): object |
|
177 | 177 | { |
178 | 178 | try { |
179 | 179 | $prepare = empty($prepare) ? $this->prepare : $prepare; |
@@ -248,12 +248,12 @@ discard block |
||
248 | 248 | $this->setLogSQL($sql, $params); |
249 | 249 | |
250 | 250 | if (!empty($class)) { |
251 | - $rs = $this->fetchArrayClass($this->prepare,$class); |
|
251 | + $rs = $this->fetchArrayClass($this->prepare, $class); |
|
252 | 252 | } else { |
253 | 253 | $rs = $this->fetchArrayObj($this->prepare); |
254 | 254 | } |
255 | 255 | } catch (PDOException $e) { |
256 | - Connect::setError($e,$sql); |
|
256 | + Connect::setError($e, $sql); |
|
257 | 257 | return false; |
258 | 258 | } |
259 | 259 | return $rs; |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | $rs = $this->prepare->execute($params); |
273 | 273 | $this->logSQL = $this->prepare->queryString; |
274 | 274 | } catch (PDOException $e) { |
275 | - Connect::setError($e,$sql); |
|
275 | + Connect::setError($e, $sql); |
|
276 | 276 | return false; |
277 | 277 | } |
278 | 278 | return $rs; |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | $rs = $query->execute($params); |
292 | 292 | $this->setLogSQL($sql, $params); |
293 | 293 | } catch (PDOException $e) { |
294 | - Connect::setError($e,$sql); |
|
294 | + Connect::setError($e, $sql); |
|
295 | 295 | return false; |
296 | 296 | } |
297 | 297 | return $rs; |
@@ -305,12 +305,12 @@ discard block |
||
305 | 305 | protected function deleteDB($sql, $params = null): bool |
306 | 306 | { |
307 | 307 | try { |
308 | - $this->getInstance();; |
|
308 | + $this->getInstance(); ; |
|
309 | 309 | $this->prepare = $this->instance->prepare($sql); |
310 | 310 | $rs = $this->prepare->execute($params); |
311 | 311 | $this->setLogSQL($sql, $params); |
312 | 312 | } catch (PDOException $e) { |
313 | - Connect::setError($e,$sql); |
|
313 | + Connect::setError($e, $sql); |
|
314 | 314 | return false; |
315 | 315 | } |
316 | 316 | return $rs; |
@@ -335,9 +335,9 @@ discard block |
||
335 | 335 | return $this->getInstance($this->database)->errorInfo(); |
336 | 336 | } |
337 | 337 | |
338 | - private function setLogSQL($sql, $placeholders){ |
|
339 | - foreach($placeholders as $k => $v){ |
|
340 | - $sql = preg_replace('?',"'".$v."'",$sql); |
|
338 | + private function setLogSQL($sql, $placeholders) { |
|
339 | + foreach ($placeholders as $k => $v) { |
|
340 | + $sql = preg_replace('?', "'" . $v . "'", $sql); |
|
341 | 341 | } |
342 | 342 | $this->logSQL = $sql; |
343 | 343 | } |