@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | protected function convertValue($value) |
52 | 52 | { |
53 | 53 | switch (true) { |
54 | - case (\is_numeric($value) && ! \is_float(1 * $value)): |
|
55 | - $value = (int)$value; |
|
54 | + case (\is_numeric($value) && !\is_float(1 * $value)): |
|
55 | + $value = (int) $value; |
|
56 | 56 | break; |
57 | - case \is_numeric($value) && \is_float(1*$value): |
|
58 | - $value = (float)$value; |
|
57 | + case \is_numeric($value) && \is_float(1 * $value): |
|
58 | + $value = (float) $value; |
|
59 | 59 | break; |
60 | 60 | default: |
61 | 61 | break; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | public function convertDate(int $timestamp, string $fieldType = 'DATETIME') |
74 | 74 | { |
75 | 75 | $date = false; |
76 | - if (! empty($timestamp) && $timestamp > 0) { |
|
76 | + if (!empty($timestamp) && $timestamp > 0) { |
|
77 | 77 | switch ($fieldType) { |
78 | 78 | case 'DATE': |
79 | 79 | $date = date('Y-m-d', $timestamp); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | if (\is_array($data)) { |
105 | 105 | $tmp = []; |
106 | 106 | foreach ($data as $alias => $field) { |
107 | - $tmp[] = ($alias !== $field && ! \is_int($alias) && $ignoreAlias === false) ? |
|
107 | + $tmp[] = ($alias !== $field && !\is_int($alias) && $ignoreAlias === false) ? |
|
108 | 108 | ($field . ' as `' . $alias . '`') : $field; |
109 | 109 | } |
110 | 110 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | } |
184 | 184 | } |
185 | 185 | |
186 | - if (! \is_scalar($values)) { |
|
186 | + if (!\is_scalar($values)) { |
|
187 | 187 | throw (new Exceptions\InvalidFieldException('values')) |
188 | 188 | ->setData($values); |
189 | 189 | } |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | { |
228 | 228 | $onlyNumbers = true; |
229 | 229 | foreach ($data as $value) { |
230 | - if (! \is_numeric($value)) { |
|
230 | + if (!\is_numeric($value)) { |
|
231 | 231 | $onlyNumbers = false; |
232 | 232 | break; |
233 | 233 | } |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | } |
273 | 273 | $data = implode(' ', $tmp); |
274 | 274 | } |
275 | - if (! is_scalar($data) || empty($data)) { |
|
275 | + if (!is_scalar($data) || empty($data)) { |
|
276 | 276 | throw new Exceptions\TableNotDefinedException($data); |
277 | 277 | } |
278 | 278 | |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | } |
296 | 296 | } |
297 | 297 | $data = trim($data); |
298 | - if (! empty($data) && stripos($data, 'WHERE') !== 0) { |
|
298 | + if (!empty($data) && stripos($data, 'WHERE') !== 0) { |
|
299 | 299 | $data = "WHERE {$data}"; |
300 | 300 | } |
301 | 301 | |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | protected function prepareOrder($data): string |
310 | 310 | { |
311 | 311 | $data = trim($data); |
312 | - if (! empty($data) && stripos($data, 'ORDER') !== 0) { |
|
312 | + if (!empty($data) && stripos($data, 'ORDER') !== 0) { |
|
313 | 313 | $data = "ORDER BY {$data}"; |
314 | 314 | } |
315 | 315 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | protected function prepareLimit($data): string |
324 | 324 | { |
325 | 325 | $data = trim($data); |
326 | - if (! empty($data) && stripos($data, 'LIMIT') !== 0) { |
|
326 | + if (!empty($data) && stripos($data, 'LIMIT') !== 0) { |
|
327 | 327 | $data = "LIMIT {$data}"; |
328 | 328 | } |
329 | 329 |
@@ -22,9 +22,9 @@ |
||
22 | 22 | protected $timeFormat = '%2.5f'; |
23 | 23 | |
24 | 24 | /** |
25 | - * @return mixed |
|
25 | + * @return mixed |
|
26 | 26 | * @throws Exceptions\Exception |
27 | - */ |
|
27 | + */ |
|
28 | 28 | abstract public function getDriver(); |
29 | 29 | |
30 | 30 | /** |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @return string|null |
44 | 44 | * @throws Exceptions\Exception |
45 | 45 | */ |
46 | - public function getLastError() :? string |
|
46 | + public function getLastError() : ? string |
|
47 | 47 | { |
48 | 48 | return $this->getDriver()->getLastError(); |
49 | 49 | } |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | * @return string|null |
53 | 53 | * @throws Exceptions\Exception |
54 | 54 | */ |
55 | - public function getLastErrorNo() :? string |
|
55 | + public function getLastErrorNo() : ? string |
|
56 | 56 | { |
57 | - return (string)$this->getDriver()->getLastErrorNo(); |
|
57 | + return (string) $this->getDriver()->getLastErrorNo(); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -192,14 +192,14 @@ discard block |
||
192 | 192 | $out .= '<fieldset style="text-align:left">'; |
193 | 193 | $out .= '<legend>Query ' . $i . ' - ' . sprintf($this->timeFormat, $query['time']) . '</legend>'; |
194 | 194 | $out .= $query['sql'] . '<br><br>'; |
195 | - if (! empty($query['element'])) { |
|
195 | + if (!empty($query['element'])) { |
|
196 | 196 | $out .= $query['element']['type'] . ' => ' . $query['element']['name'] . '<br>'; |
197 | 197 | } |
198 | - if (! empty($query['event'])) { |
|
198 | + if (!empty($query['event'])) { |
|
199 | 199 | $out .= 'Current Event => ' . $query['event'] . '<br>'; |
200 | 200 | } |
201 | 201 | $out .= 'Affected Rows => ' . $query['rows'] . '<br>'; |
202 | - if (! empty($query['path'])) { |
|
202 | + if (!empty($query['path'])) { |
|
203 | 203 | $out .= 'Functions Path => ' . $query['path'] . '<br>'; |
204 | 204 | } |
205 | 205 | /*$out .= 'Functions Path => ' . $query['path']['method'] . '<br>'; |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | public function __construct($message = "", $code = 0, Throwable $previous = null) |
14 | 14 | { |
15 | - parent::__construct($message, (int)$code, $previous); |
|
15 | + parent::__construct($message, (int) $code, $previous); |
|
16 | 16 | |
17 | 17 | $this->code = $code; |
18 | 18 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function getConnect() : Connection |
57 | 57 | { |
58 | - if (! $this->isConnected()) { |
|
58 | + if (!$this->isConnected()) { |
|
59 | 59 | return $this->connect(); |
60 | 60 | } |
61 | 61 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $method = $this->config['method']; |
173 | 173 | } |
174 | 174 | |
175 | - return (bool)$this->query($method . ' ' . $charset . ' COLLATE ' . $collation); |
|
175 | + return (bool) $this->query($method . ' ' . $charset . ' COLLATE ' . $collation); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | /** |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * @param int $col |
199 | 199 | * @return string|null |
200 | 200 | */ |
201 | - public function fieldName($result, $col = 0) :? string |
|
201 | + public function fieldName($result, $col = 0) : ? string |
|
202 | 202 | { |
203 | 203 | $field = $result->getColumnMeta($col); |
204 | 204 | return $field['name'] ?? null; |
@@ -356,18 +356,18 @@ discard block |
||
356 | 356 | * @return string|null |
357 | 357 | * @throws Exceptions\Exception |
358 | 358 | */ |
359 | - public function getLastError() :? string |
|
359 | + public function getLastError() : ? string |
|
360 | 360 | { |
361 | - return (string)($this->getConnect()->getPdo()->errorInfo()[2] ?? $this->lastError[2]); |
|
361 | + return (string) ($this->getConnect()->getPdo()->errorInfo()[2] ?? $this->lastError[2]); |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | /** |
365 | 365 | * @return string|null |
366 | 366 | * @throws Exceptions\Exception |
367 | 367 | */ |
368 | - public function getLastErrorNo() :? string |
|
368 | + public function getLastErrorNo() : ? string |
|
369 | 369 | { |
370 | - return (string)($this->getConnect()->getPdo()->errorInfo()[1] ?? $this->lastErrorNo); |
|
370 | + return (string) ($this->getConnect()->getPdo()->errorInfo()[1] ?? $this->lastErrorNo); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function getConnect() |
39 | 39 | { |
40 | - if (! $this->isConnected()) { |
|
40 | + if (!$this->isConnected()) { |
|
41 | 41 | return $this->connect(); |
42 | 42 | } |
43 | 43 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | throw new Exceptions\ConnectException($this->conn->connect_error); |
63 | 63 | } |
64 | 64 | |
65 | - if (! $this->isConnected()) { |
|
65 | + if (!$this->isConnected()) { |
|
66 | 66 | throw new Exceptions\ConnectException( |
67 | 67 | $this->getLastError() ?: 'Failed to create the database connection!' |
68 | 68 | ); |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * @param int $col |
180 | 180 | * @return string|null |
181 | 181 | */ |
182 | - public function fieldName($result, $col = 0) :? string |
|
182 | + public function fieldName($result, $col = 0) : ? string |
|
183 | 183 | { |
184 | 184 | $field = $result->fetch_field_direct($col); |
185 | 185 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * @return string|null |
324 | 324 | * @throws Exceptions\Exception |
325 | 325 | */ |
326 | - public function getLastError() :? string |
|
326 | + public function getLastError() : ? string |
|
327 | 327 | { |
328 | 328 | return $this->getConnect()->error; |
329 | 329 | } |
@@ -332,9 +332,9 @@ discard block |
||
332 | 332 | * @return string|null |
333 | 333 | * @throws Exceptions\Exception |
334 | 334 | */ |
335 | - public function getLastErrorNo() :? string |
|
335 | + public function getLastErrorNo() : ? string |
|
336 | 336 | { |
337 | - return (string)$this->getConnect()->errno; |
|
337 | + return (string) $this->getConnect()->errno; |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | /** |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | 'collation' |
57 | 57 | )); |
58 | 58 | |
59 | - if (! \in_array(Interfaces\DriverInterface::class, class_implements($driver), true)) { |
|
59 | + if (!\in_array(Interfaces\DriverInterface::class, class_implements($driver), true)) { |
|
60 | 60 | throw new Exceptions\DriverException( |
61 | 61 | $driver . ' should implements the ' . Interfaces\DriverInterface::class |
62 | 62 | ); |
@@ -282,13 +282,12 @@ discard block |
||
282 | 282 | |
283 | 283 | if (\is_array($fields)) { |
284 | 284 | $useFields = empty($fromTable) ? |
285 | - $this->prepareValues($fields) : |
|
286 | - $this->prepareFields($fields, true); |
|
285 | + $this->prepareValues($fields) : $this->prepareFields($fields, true); |
|
287 | 286 | } else { |
288 | 287 | $useFields = $fields; |
289 | 288 | } |
290 | 289 | |
291 | - if (empty($useFields) || ! \is_scalar($useFields) || ($useFields === '*' && ! empty($fromTable))) { |
|
290 | + if (empty($useFields) || !\is_scalar($useFields) || ($useFields === '*' && !empty($fromTable))) { |
|
292 | 291 | throw (new Exceptions\InvalidFieldException('Invalid insert fields')) |
293 | 292 | ->setData($fields); |
294 | 293 | } |
@@ -365,7 +364,7 @@ discard block |
||
365 | 364 | * @param int $col |
366 | 365 | * @return string|null |
367 | 366 | */ |
368 | - public function fieldName($result, $col = 0) :? string |
|
367 | + public function fieldName($result, $col = 0) : ? string |
|
369 | 368 | { |
370 | 369 | return $this->getDriver()->fieldName($result, $col); |
371 | 370 | } |
@@ -480,7 +479,7 @@ discard block |
||
480 | 479 | public function getTableMetaData(string $table) : array |
481 | 480 | { |
482 | 481 | $metadata = []; |
483 | - if (! empty($table)) { |
|
482 | + if (!empty($table)) { |
|
484 | 483 | $sql = 'SHOW FIELDS FROM ' . $table; |
485 | 484 | $result = $this->query($sql); |
486 | 485 | $metadata = $this->getDriver()->getTableMetaData($result); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * @param int $col |
80 | 80 | * @return null|string |
81 | 81 | */ |
82 | - public function fieldName($result, $col = 0) :? string; |
|
82 | + public function fieldName($result, $col = 0) : ? string; |
|
83 | 83 | |
84 | 84 | /** |
85 | 85 | * @param string $name |
@@ -128,12 +128,12 @@ discard block |
||
128 | 128 | /** |
129 | 129 | * @return string|null |
130 | 130 | */ |
131 | - public function getLastError() :? string; |
|
131 | + public function getLastError() : ? string; |
|
132 | 132 | |
133 | 133 | /** |
134 | 134 | * @return string|null |
135 | 135 | */ |
136 | - public function getLastErrorNo() :? string; |
|
136 | + public function getLastErrorNo() : ? string; |
|
137 | 137 | |
138 | 138 | /** |
139 | 139 | * @param $result |