Completed
Push — master ( bbde74...290f10 )
by Ivan
13:51
created
src/DriverAbstract.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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).
Please login to merge, or discard this patch.
src/driver/pdo/Driver.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/driver/pdo/Statement.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,28 +24,28 @@
 block discarded – undo
24 24
         foreach ($data as $i => $v) {
25 25
             switch (gettype($v)) {
26 26
                 case 'boolean':
27
-                    $this->statement->bindValue($i+1, $v, \PDO::PARAM_BOOL);
27
+                    $this->statement->bindValue($i + 1, $v, \PDO::PARAM_BOOL);
28 28
                     break;
29 29
                 case 'integer':
30
-                    $this->statement->bindValue($i+1, $v, \PDO::PARAM_INT);
30
+                    $this->statement->bindValue($i + 1, $v, \PDO::PARAM_INT);
31 31
                     break;
32 32
                 case 'NULL':
33
-                    $this->statement->bindValue($i+1, $v, \PDO::PARAM_NULL);
33
+                    $this->statement->bindValue($i + 1, $v, \PDO::PARAM_NULL);
34 34
                     break;
35 35
                 case 'double':
36
-                    $this->statement->bindValue($i+1, $v);
36
+                    $this->statement->bindValue($i + 1, $v);
37 37
                     break;
38 38
                 default:
39 39
                     // keep in mind oracle needs a transaction when inserting LOBs, aside from the specific syntax:
40 40
                     // INSERT INTO table (column, lobcolumn) VALUES (?, ?, EMPTY_BLOB()) RETURNING lobcolumn INTO ?
41 41
                     if (is_resource($v) && get_resource_type($v) === 'stream') {
42
-                        $this->statement->bindParam($i+1, $v, \PDO::PARAM_LOB);
42
+                        $this->statement->bindParam($i + 1, $v, \PDO::PARAM_LOB);
43 43
                         break;
44 44
                     }
45 45
                     if (!is_string($data[$i])) {
46 46
                         $data[$i] = serialize($data[$i]);
47 47
                     }
48
-                    $this->statement->bindValue($i+1, $v);
48
+                    $this->statement->bindValue($i + 1, $v);
49 49
                     break;
50 50
             }
51 51
         }
Please login to merge, or discard this patch.
src/driver/oracle/Schema.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@
 block discarded – undo
124 124
                     }
125 125
                     return $new;
126 126
                 })
127
-                 as $relation
127
+                    as $relation
128 128
             ) {
129 129
                 $relations[$relation['CONSTRAINT_NAME']]['table'] = $relation['TABLE_NAME'];
130 130
                 $relations[$relation['CONSTRAINT_NAME']]['keymap'][$primary[(int)$relation['POSITION']-1]] =
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -32,19 +32,19 @@  discard block
 block discarded – undo
32 32
         $columns = Collection::from($this
33 33
             ->query(
34 34
                 "SELECT * FROM all_tab_cols WHERE UPPER(table_name) = ? AND UPPER(owner) = ? and hidden_column = 'NO'",
35
-                [ strtoupper($table), strtoupper($this->name()) ]
35
+                [strtoupper($table), strtoupper($this->name())]
36 36
             ))
37
-            ->map(function ($v) {
37
+            ->map(function($v) {
38 38
                 $new = [];
39 39
                 foreach ($v as $kk => $vv) {
40 40
                     $new[strtoupper($kk)] = $vv;
41 41
                 }
42 42
                 return $new;
43 43
             })
44
-            ->mapKey(function ($v): string {
44
+            ->mapKey(function($v): string {
45 45
                 return $v['COLUMN_NAME'];
46 46
             })
47
-            ->map(function ($v) {
47
+            ->map(function($v) {
48 48
                 $v['length'] = null;
49 49
                 if (!isset($v['DATA_TYPE'])) {
50 50
                     return $v;
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
                     default:
57 57
                         if (strpos($type, 'char') !== false && strpos($type, '(') !== false) {
58 58
                             // extract length from varchar
59
-                            $v['length'] = (int)explode(')', (explode('(', $type)[1] ?? ''))[0];
59
+                            $v['length'] = (int) explode(')', (explode('(', $type)[1] ?? ''))[0];
60 60
                             $v['length'] = $v['length'] > 0 ? $v['length'] : null;
61 61
                         }
62 62
                         break;
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
             ->query(
73 73
                 "SELECT constraint_name FROM all_constraints
74 74
                 WHERE table_name = ? AND constraint_type = ? AND UPPER(owner) = ?",
75
-                [ strtoupper($table), 'P', $owner ]
75
+                [strtoupper($table), 'P', $owner]
76 76
             ))
77
-            ->map(function ($v) {
77
+            ->map(function($v) {
78 78
                 $new = [];
79 79
                 foreach ($v as $kk => $vv) {
80 80
                     $new[strtoupper($kk)] = $vv;
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
                 ->query(
90 90
                     "SELECT column_name FROM all_cons_columns
91 91
                     WHERE table_name = ? AND constraint_name = ? AND UPPER(owner) = ?",
92
-                    [ strtoupper($table), $pkname, $owner ]
92
+                    [strtoupper($table), $pkname, $owner]
93 93
                 ))
94
-                ->map(function ($v) {
94
+                ->map(function($v) {
95 95
                     $new = [];
96 96
                     foreach ($v as $kk => $vv) {
97 97
                         $new[strtoupper($kk)] = $vv;
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
                         UPPER(ac.OWNER) = ? AND UPPER(ac.R_OWNER) = ? AND
121 121
                         ac.R_CONSTRAINT_NAME = ? AND ac.CONSTRAINT_TYPE = ?
122 122
                     ORDER BY cc.POSITION",
123
-                    [ $owner, $owner, $pkname, 'R' ]
123
+                    [$owner, $owner, $pkname, 'R']
124 124
                 ))
125
-                ->map(function ($v) {
125
+                ->map(function($v) {
126 126
                     $new = [];
127 127
                     foreach ($v as $kk => $vv) {
128 128
                         $new[strtoupper($kk)] = $vv;
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
                  as $relation
133 133
             ) {
134 134
                 $relations[$relation['CONSTRAINT_NAME']]['table'] = $relation['TABLE_NAME'];
135
-                $relations[$relation['CONSTRAINT_NAME']]['keymap'][$primary[(int)$relation['POSITION']-1]] =
135
+                $relations[$relation['CONSTRAINT_NAME']]['keymap'][$primary[(int) $relation['POSITION'] - 1]] =
136 136
                     $relation['COLUMN_NAME'];
137 137
             }
138 138
             foreach ($relations as $data) {
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
                                 ac.TABLE_NAME = ? AND ac.CONSTRAINT_TYPE = ? AND
164 164
                                 cc.COLUMN_NAME IN (??)
165 165
                             ORDER BY POSITION",
166
-                            [ $owner, $owner, $data['table'], 'R', $columns ]
166
+                            [$owner, $owner, $data['table'], 'R', $columns]
167 167
                         ))
168
-                        ->map(function ($v) {
168
+                        ->map(function($v) {
169 169
                             $new = [];
170 170
                             foreach ($v as $kk => $vv) {
171 171
                                 $new[strtoupper($kk)] = $vv;
@@ -185,9 +185,9 @@  discard block
 block discarded – undo
185 185
                         ->query(
186 186
                             "SELECT COLUMN_NAME FROM all_cons_columns
187 187
                              WHERE UPPER(OWNER) = ? AND CONSTRAINT_NAME = ? ORDER BY POSITION",
188
-                            [ $owner, current($foreign['keymap']) ]
188
+                            [$owner, current($foreign['keymap'])]
189 189
                         ))
190
-                        ->map(function ($v) {
190
+                        ->map(function($v) {
191 191
                             $new = [];
192 192
                             foreach ($v as $kk => $vv) {
193 193
                                 $new[strtoupper($kk)] = $vv;
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
                     $relname = $foreign['table'];
203 203
                     $cntr = 1;
204 204
                     while ($definition->hasRelation($relname) || $definition->getName() == $relname) {
205
-                        $relname = $foreign['table'] . '_' . (++ $cntr);
205
+                        $relname = $foreign['table'].'_'.(++$cntr);
206 206
                     }
207 207
                     $definition->addRelation(
208 208
                         new TableRelation(
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
                     $relname = $data['table'];
219 219
                     $cntr = 1;
220 220
                     while ($definition->hasRelation($relname) || $definition->getName() == $relname) {
221
-                        $relname = $data['table'] . '_' . (++ $cntr);
221
+                        $relname = $data['table'].'_'.(++$cntr);
222 222
                     }
223 223
                     $definition->addRelation(
224 224
                         new TableRelation(
@@ -246,9 +246,9 @@  discard block
 block discarded – undo
246 246
                     LEFT JOIN all_cons_columns cc ON cc.OWNER = ac.OWNER AND cc.CONSTRAINT_NAME = ac.CONSTRAINT_NAME
247 247
                     WHERE UPPER(ac.OWNER) = ? AND UPPER(ac.R_OWNER) = ? AND ac.TABLE_NAME = ? AND ac.CONSTRAINT_TYPE = ?
248 248
                     ORDER BY cc.POSITION",
249
-                    [ $owner, $owner, strtoupper($table), 'R' ]
249
+                    [$owner, $owner, strtoupper($table), 'R']
250 250
                 ))
251
-                ->map(function ($v) {
251
+                ->map(function($v) {
252 252
                     $new = [];
253 253
                     foreach ($v as $kk => $vv) {
254 254
                         $new[strtoupper($kk)] = $vv;
@@ -266,9 +266,9 @@  discard block
 block discarded – undo
266 266
                     ->query(
267 267
                         "SELECT COLUMN_NAME FROM all_cons_columns
268 268
                          WHERE UPPER(OWNER) = ? AND CONSTRAINT_NAME = ? ORDER BY POSITION",
269
-                        [ $owner, current($data['keymap']) ]
269
+                        [$owner, current($data['keymap'])]
270 270
                     ))
271
-                    ->map(function ($v) {
271
+                    ->map(function($v) {
272 272
                         $new = [];
273 273
                         foreach ($v as $kk => $vv) {
274 274
                             $new[strtoupper($kk)] = $vv;
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
                 $relname = $data['table'];
284 284
                 $cntr = 1;
285 285
                 while ($definition->hasRelation($relname) || $definition->getName() == $relname) {
286
-                    $relname = $data['table'] . '_' . (++ $cntr);
286
+                    $relname = $data['table'].'_'.(++$cntr);
287 287
                 }
288 288
                 $definition->addRelation(
289 289
                     new TableRelation(
@@ -306,18 +306,18 @@  discard block
 block discarded – undo
306 306
                  SELECT VIEW_NAME AS TABLE_NAME FROM ALL_VIEWS where UPPER(OWNER) = ?",
307 307
                 [strtoupper($this->connection['name']), strtoupper($this->connection['name'])]
308 308
             ))
309
-            ->map(function ($v) {
309
+            ->map(function($v) {
310 310
                 $new = [];
311 311
                 foreach ($v as $kk => $vv) {
312 312
                     $new[strtoupper($kk)] = $vv;
313 313
                 }
314 314
                 return $new;
315 315
             })
316
-            ->mapKey(function ($v) {
316
+            ->mapKey(function($v) {
317 317
                 return strtolower($v['TABLE_NAME']);
318 318
             })
319 319
             ->pluck('TABLE_NAME')
320
-            ->map(function ($v) {
320
+            ->map(function($v) {
321 321
                 return $this->table($v)->toLowerCase();
322 322
             })
323 323
             ->toArray();
Please login to merge, or discard this patch.
src/schema/TableQueryIterator.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 = [];
Please login to merge, or discard this patch.
src/driver/oracle/Statement.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
             if (!is_array($err)) {
61 61
                 $err = [];
62 62
             }
63
-            if ($log && (int)$this->driver->option('log_errors', 1)) {
63
+            if ($log && (int) $this->driver->option('log_errors', 1)) {
64 64
                 @file_put_contents(
65 65
                     $log,
66
-                    '--' . date('Y-m-d H:i:s') . ' ERROR: ' . implode(',', $err) . "\r\n" .
67
-                    $this->sql . "\r\n" .
66
+                    '--'.date('Y-m-d H:i:s').' ERROR: '.implode(',', $err)."\r\n".
67
+                    $this->sql."\r\n".
68 68
                     "\r\n",
69 69
                     FILE_APPEND
70 70
                 );
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
         }
74 74
         if ($log) {
75 75
             $tm = microtime(true) - $tm;
76
-            if ($tm >= (float)$this->driver->option('log_slow', 0)) {
76
+            if ($tm >= (float) $this->driver->option('log_slow', 0)) {
77 77
                 @file_put_contents(
78 78
                     $log,
79
-                    '--' . date('Y-m-d H:i:s') . ' ' . sprintf('%01.6f', $tm) . "s\r\n" .
80
-                    $this->sql . "\r\n" .
79
+                    '--'.date('Y-m-d H:i:s').' '.sprintf('%01.6f', $tm)."s\r\n".
80
+                    $this->sql."\r\n".
81 81
                     "\r\n",
82 82
                     FILE_APPEND
83 83
                 );
Please login to merge, or discard this patch.
src/driver/mysql/Driver.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
                 );
Please login to merge, or discard this patch.
src/driver/sphinx/Driver.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
                 );
Please login to merge, or discard this patch.
src/driver/pdo/Result.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,8 +57,8 @@
 block discarded – undo
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
     {
Please login to merge, or discard this patch.