@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | $new = ''; |
13 | 13 | $par = array_values($par); |
14 | 14 | if (substr_count($sql, '?') === 2 && !is_array($par[0])) { |
15 | - $par = [ $par ]; |
|
15 | + $par = [$par]; |
|
16 | 16 | } |
17 | 17 | $parts = explode('??', $sql); |
18 | 18 | $index = 0; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $index += count($tmp) - 1; |
23 | 23 | if (isset($par[$index])) { |
24 | 24 | if (!is_array($par[$index])) { |
25 | - $par[$index] = [ $par[$index] ]; |
|
25 | + $par[$index] = [$par[$index]]; |
|
26 | 26 | } |
27 | 27 | $params = $par[$index]; |
28 | 28 | array_splice($par, $index, 1, $params); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $new .= implode(',', array_fill(0, count($params), '?')); |
31 | 31 | } |
32 | 32 | } |
33 | - return [ $new, $par ]; |
|
33 | + return [$new, $par]; |
|
34 | 34 | } |
35 | 35 | /** |
36 | 36 | * Run a query (prepare & execute). |
@@ -44,7 +44,7 @@ |
||
44 | 44 | isset($this->connection['opts']) ? $this->connection['opts'] : [] |
45 | 45 | ); |
46 | 46 | } catch (\PDOException $e) { |
47 | - throw new DBException('Connect error: ' . $e->getMessage()); |
|
47 | + throw new DBException('Connect error: '.$e->getMessage()); |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $fields = []; |
77 | 77 | $exists = false; |
78 | 78 | foreach ($relation->table->getColumns() as $column) { |
79 | - $nm = $name . static::SEP . $column; |
|
79 | + $nm = $name.static::SEP.$column; |
|
80 | 80 | if (isset($this->aliases[$nm])) { |
81 | 81 | $nm = $this->aliases[$nm]; |
82 | 82 | } |
@@ -90,17 +90,17 @@ discard block |
||
90 | 90 | $parts = explode(static::SEP, $name); |
91 | 91 | $name = array_pop($parts); |
92 | 92 | if (!$exists && !count($parts) && !isset($temp[$name])) { |
93 | - $temp[$name] = $relation->many ? [ '___clean' => true ] : null; |
|
93 | + $temp[$name] = $relation->many ? ['___clean' => true] : null; |
|
94 | 94 | } |
95 | 95 | if ($exists) { |
96 | - $full = ''; |
|
96 | + $full = ''; |
|
97 | 97 | foreach ($parts as $item) { |
98 | - $full = $full ? $full . static::SEP . $item : $item; |
|
98 | + $full = $full ? $full.static::SEP.$item : $item; |
|
99 | 99 | $temp = &$temp[$item]; |
100 | 100 | if ($this->relations[$full][0]->many) { |
101 | 101 | $rpk = []; |
102 | 102 | foreach ($this->relations[$full][0]->table->getPrimaryKey() as $pkey) { |
103 | - $nm = $full . static::SEP . $pkey; |
|
103 | + $nm = $full.static::SEP.$pkey; |
|
104 | 104 | if (isset($this->aliases[$nm])) { |
105 | 105 | $nm = $this->aliases[$nm]; |
106 | 106 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | } |
111 | 111 | } |
112 | 112 | if (!isset($temp[$name])) { |
113 | - $temp[$name] = $relation->many ? [ '___clean' => true ] : null; |
|
113 | + $temp[$name] = $relation->many ? ['___clean' => true] : null; |
|
114 | 114 | } |
115 | 115 | $temp = &$temp[$name]; |
116 | 116 | if ($relation->many) { |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | return; |
177 | 177 | } |
178 | 178 | } |
179 | - $this->fetched ++; |
|
179 | + $this->fetched++; |
|
180 | 180 | while ($this->result->valid()) { |
181 | 181 | $row = $this->result->current(); |
182 | 182 | $pk = []; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | { |
38 | 38 | if ($this->lnk === null) { |
39 | 39 | $this->lnk = new \mysqli( |
40 | - (isset($this->connection['opts']['persist']) && $this->connection['opts']['persist'] ? 'p:' : '') . |
|
40 | + (isset($this->connection['opts']['persist']) && $this->connection['opts']['persist'] ? 'p:' : ''). |
|
41 | 41 | $this->connection['host'], |
42 | 42 | $this->connection['user'], |
43 | 43 | $this->connection['pass'], |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | $res = $this->lnk->query($sql); |
98 | 98 | if ($log) { |
99 | 99 | $tm = microtime(true) - $tm; |
100 | - if ($tm >= (float)$this->option('log_slow', 0)) { |
|
100 | + if ($tm >= (float) $this->option('log_slow', 0)) { |
|
101 | 101 | @file_put_contents( |
102 | 102 | $log, |
103 | - '--' . date('Y-m-d H:i:s') . ' ' . sprintf('%01.6f', $tm) . "s\r\n" . |
|
104 | - $sql . "\r\n" . |
|
103 | + '--'.date('Y-m-d H:i:s').' '.sprintf('%01.6f', $tm)."s\r\n". |
|
104 | + $sql."\r\n". |
|
105 | 105 | "\r\n", |
106 | 106 | FILE_APPEND |
107 | 107 | ); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | { |
38 | 38 | if ($this->lnk === null) { |
39 | 39 | $this->lnk = new \mysqli( |
40 | - (isset($this->connection['opts']['persist']) && $this->connection['opts']['persist'] ? 'p:' : '') . |
|
40 | + (isset($this->connection['opts']['persist']) && $this->connection['opts']['persist'] ? 'p:' : ''). |
|
41 | 41 | $this->connection['host'], |
42 | 42 | $this->connection['user'], |
43 | 43 | $this->connection['pass'], |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | $res = $this->lnk->query($sql); |
98 | 98 | if ($log) { |
99 | 99 | $tm = microtime(true) - $tm; |
100 | - if ($tm >= (float)$this->option('log_slow', 0)) { |
|
100 | + if ($tm >= (float) $this->option('log_slow', 0)) { |
|
101 | 101 | @file_put_contents( |
102 | 102 | $log, |
103 | - '--' . date('Y-m-d H:i:s') . ' ' . sprintf('%01.6f', $tm) . "s\r\n" . |
|
104 | - $sql . "\r\n" . |
|
103 | + '--'.date('Y-m-d H:i:s').' '.sprintf('%01.6f', $tm)."s\r\n". |
|
104 | + $sql."\r\n". |
|
105 | 105 | "\r\n", |
106 | 106 | FILE_APPEND |
107 | 107 | ); |
@@ -57,8 +57,8 @@ |
||
57 | 57 | } |
58 | 58 | public function next(): void |
59 | 59 | { |
60 | - $this->fetched ++; |
|
61 | - $this->last = $this->statement->fetch(\PDO::FETCH_ASSOC)?:null; |
|
60 | + $this->fetched++; |
|
61 | + $this->last = $this->statement->fetch(\PDO::FETCH_ASSOC) ?: null; |
|
62 | 62 | } |
63 | 63 | public function valid(): bool |
64 | 64 | { |
@@ -57,8 +57,8 @@ |
||
57 | 57 | } |
58 | 58 | public function next(): void |
59 | 59 | { |
60 | - $this->fetched ++; |
|
61 | - $this->last = $this->result->fetch_assoc()?:null; |
|
60 | + $this->fetched++; |
|
61 | + $this->last = $this->result->fetch_assoc() ?: null; |
|
62 | 62 | } |
63 | 63 | public function valid(): bool |
64 | 64 | { |
@@ -78,7 +78,7 @@ |
||
78 | 78 | } |
79 | 79 | public function next(): void |
80 | 80 | { |
81 | - $this->fetched ++; |
|
81 | + $this->fetched++; |
|
82 | 82 | $temp = \odbc_fetch_row($this->statement); |
83 | 83 | if (!$temp) { |
84 | 84 | $this->last = null; |
@@ -62,8 +62,8 @@ |
||
62 | 62 | } |
63 | 63 | public function next(): void |
64 | 64 | { |
65 | - $this->fetched ++; |
|
66 | - $this->last = $this->statement->fetchArray(\SQLITE3_ASSOC)?:null; |
|
65 | + $this->fetched++; |
|
66 | + $this->last = $this->statement->fetchArray(\SQLITE3_ASSOC) ?: null; |
|
67 | 67 | } |
68 | 68 | public function valid(): bool |
69 | 69 | { |