Completed
Push — master ( ae602d...793829 )
by Ivan
03:04
created
src/driver/mysql/Statement.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@
 block discarded – undo
83 83
             }
84 84
         }
85 85
         if (!$this->statement->execute()) {
86
-            throw new DBException('Prepared execute error: ' . $this->statement->error);
86
+            throw new DBException('Prepared execute error: '.$this->statement->error);
87 87
         }
88 88
         return new Result($this->statement, $buff);
89 89
     }
Please login to merge, or discard this patch.
src/DB.php 1 patch
Spacing   +14 added lines, -16 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         $connection['pass'] = isset($temp['pass']) && strlen($temp['pass']) ? $temp['pass'] : null;
75 75
         $connection['host'] = isset($temp['host']) && strlen($temp['host']) ? $temp['host'] : null;
76 76
         $connection['name'] = isset($temp['path']) && strlen($temp['path']) ? trim($temp['path'], '/') : null;
77
-        $connection['port'] = isset($temp['port']) && (int)$temp['port'] ? (int)$temp['port'] : null;
77
+        $connection['port'] = isset($temp['port']) && (int) $temp['port'] ? (int) $temp['port'] : null;
78 78
         if (isset($temp['query']) && strlen($temp['query'])) {
79 79
             parse_str($temp['query'], $connection['opts']);
80 80
         }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
         $new = '';
118 118
         $par = array_values($par);
119 119
         if (substr_count($sql, '?') === 2 && !is_array($par[0])) {
120
-            $par = [ $par ];
120
+            $par = [$par];
121 121
         }
122 122
         $parts = explode('??', $sql);
123 123
         $index = 0;
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
             $index += count($tmp) - 1;
128 128
             if (isset($par[$index])) {
129 129
                 if (!is_array($par[$index])) {
130
-                    $par[$index] = [ $par[$index] ];
130
+                    $par[$index] = [$par[$index]];
131 131
                 }
132 132
                 $params = $par[$index];
133 133
                 array_splice($par, $index, 1, $params);
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
                 $new .= implode(',', array_fill(0, count($params), '?'));
136 136
             }
137 137
         }
138
-        return [ $new, $par ];
138
+        return [$new, $par];
139 139
     }
140 140
     /**
141 141
      * Run a query (prepare & execute).
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
     ): Collection {
176 176
         $coll = Collection::from($this->query($sql, $par, $buff));
177 177
         if (($keys = $this->driver->option('mode')) && in_array($keys, ['strtoupper', 'strtolower'])) {
178
-            $coll->map(function ($v) use ($keys) {
178
+            $coll->map(function($v) use ($keys) {
179 179
                 $new = [];
180 180
                 foreach ($v as $k => $vv) {
181 181
                     $new[call_user_func($keys, $k)] = $vv;
@@ -184,18 +184,18 @@  discard block
 block discarded – undo
184 184
             });
185 185
         }
186 186
         if ($key !== null) {
187
-            $coll->mapKey(function ($v) use ($key) {
187
+            $coll->mapKey(function($v) use ($key) {
188 188
                 return $v[$key];
189 189
             });
190 190
         }
191 191
         if ($skip) {
192
-            $coll->map(function ($v) use ($key) {
192
+            $coll->map(function($v) use ($key) {
193 193
                 unset($v[$key]);
194 194
                 return $v;
195 195
             });
196 196
         }
197 197
         if ($opti) {
198
-            $coll->map(function ($v) {
198
+            $coll->map(function($v) {
199 199
                 return count($v) === 1 ? current($v) : $v;
200 200
             });
201 201
         }
@@ -290,8 +290,7 @@  discard block
 block discarded – undo
290 290
     public function definition(string $table, bool $detectRelations = true) : Table
291 291
     {
292 292
         return isset($this->tables[$table]) ?
293
-            $this->tables[$table] :
294
-            $this->driver->table($table, $detectRelations);
293
+            $this->tables[$table] : $this->driver->table($table, $detectRelations);
295 294
     }
296 295
     /**
297 296
      * Parse all tables from the database.
@@ -308,12 +307,12 @@  discard block
 block discarded – undo
308 307
      */
309 308
     public function getSchema($asPlainArray = true)
310 309
     {
311
-        return !$asPlainArray ? $this->tables : array_map(function ($table) {
310
+        return !$asPlainArray ? $this->tables : array_map(function($table) {
312 311
             return [
313 312
                 'name' => $table->getName(),
314 313
                 'pkey' => $table->getPrimaryKey(),
315 314
                 'comment' => $table->getComment(),
316
-                'columns' => array_map(function ($column) {
315
+                'columns' => array_map(function($column) {
317 316
                     return [
318 317
                         'name' => $column->getName(),
319 318
                         'type' => $column->getType(),
@@ -324,9 +323,9 @@  discard block
 block discarded – undo
324 323
                         'nullable' => $column->isNullable()
325 324
                     ];
326 325
                 }, $table->getFullColumns()),
327
-                'relations' => array_map(function ($rel) {
326
+                'relations' => array_map(function($rel) {
328 327
                     $relation = clone $rel;
329
-                    $relation = (array)$relation;
328
+                    $relation = (array) $relation;
330 329
                     $relation['table'] = $rel->table->getName();
331 330
                     if ($rel->pivot) {
332 331
                         $relation['pivot'] = $rel->pivot->getName();
@@ -379,8 +378,7 @@  discard block
 block discarded – undo
379 378
     public function table(string $table, bool $mapped = false)
380 379
     {
381 380
         return $mapped ?
382
-            new TableQueryMapped($this, $this->definition($table)) :
383
-            new TableQuery($this, $this->definition($table));
381
+            new TableQueryMapped($this, $this->definition($table)) : new TableQuery($this, $this->definition($table));
384 382
     }
385 383
     public function __call($method, $args)
386 384
     {
Please login to merge, or discard this patch.