Completed
Push — master ( acf079...5e69a5 )
by Ivan
20:38 queued 05:34
created
src/schema/Mapper.php 1 patch
Spacing   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     public function collection(TableQueryIterator $iterator, Table $definition) : Collection
53 53
     {
54 54
         return Collection::from($iterator)
55
-            ->map(function ($v) use ($definition) {
55
+            ->map(function($v) use ($definition) {
56 56
                 return $this->entity($definition, $v);
57 57
             });
58 58
     }
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
         $definition = $entity->definition();
128 128
         foreach ($definition->getColumns() as $column) {
129 129
             if (!array_key_exists($column, $data)) {
130
-                $entity->__lazyProperty($column, function () use ($definition, $primary, $column) {
130
+                $entity->__lazyProperty($column, function() use ($definition, $primary, $column) {
131 131
                     $query = $this->db->table($definition->getFullName());
132 132
                     foreach ($primary as $k => $v) {
133 133
                         $query->filter($k, $v);
@@ -141,12 +141,12 @@  discard block
 block discarded – undo
141 141
                 $name,
142 142
                 array_key_exists($name, $data) && isset($data[$name]) ?
143 143
                     ($relation->many ?
144
-                        array_map(function ($v) use ($relation) {
144
+                        array_map(function($v) use ($relation) {
145 145
                             return $this->entity($relation->table, $v);
146 146
                         }, $data[$name]) :
147 147
                         $this->entity($relation->table, $data[$name])
148 148
                     ) :
149
-                    function (array $columns = null) use ($entity, $definition, $relation, $data) {
149
+                    function(array $columns = null) use ($entity, $definition, $relation, $data) {
150 150
                         $query = $this->db->table($relation->table->getFullName(), true);
151 151
                         if ($columns !== null) {
152 152
                             $query->columns($columns);
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
                                 );
173 173
                             }
174 174
                             foreach ($definition->getPrimaryKey() as $v) {
175
-                                $query->filter($nm . '.' . $v, $data[$v] ?? null);
175
+                                $query->filter($nm.'.'.$v, $data[$v] ?? null);
176 176
                             }
177 177
                         } else {
178 178
                             foreach ($relation->keymap as $k => $v) {
@@ -180,8 +180,7 @@  discard block
 block discarded – undo
180 180
                             }
181 181
                         }
182 182
                         return $relation->many ?
183
-                            $query->iterator() :
184
-                            $query[0];
183
+                            $query->iterator() : $query[0];
185 184
                     }
186 185
             );
187 186
         }
Please login to merge, or discard this patch.
src/schema/Table.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     public function setPrimaryKey($column) : Table
83 83
     {
84 84
         if (!is_array($column)) {
85
-            $column = [ $column ];
85
+            $column = [$column];
86 86
         }
87 87
         $this->data['primary'] = array_values($column);
88 88
         return $this;
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      */
110 110
     public function getFullName()
111 111
     {
112
-        return ($this->data['schema'] ? $this->data['schema'] . '.' : '') . $this->data['name'];
112
+        return ($this->data['schema'] ? $this->data['schema'].'.' : '').$this->data['name'];
113 113
     }
114 114
     /**
115 115
      * Get a column definition
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
         }
185 185
 
186 186
         if (!isset($name)) {
187
-            $name = $toTable->getName() . '_' . implode('_', array_keys($keymap));
187
+            $name = $toTable->getName().'_'.implode('_', array_keys($keymap));
188 188
         }
189 189
         $this->addRelation(new TableRelation(
190 190
             $name,
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/postgre/Schema.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
             $table = $temp[1];
30 30
         }
31 31
 
32
-        if (isset($tables[$schema . '.' . $table])) {
33
-            return $tables[$schema . '.' . $table];
32
+        if (isset($tables[$schema.'.'.$table])) {
33
+            return $tables[$schema.'.'.$table];
34 34
         }
35 35
 
36 36
         static $relationsT = null;
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
                         (kc.table_schema = ? OR ct.table_schema = ?) AND
62 62
                         kc.table_name IS NOT NULL AND
63 63
                         kc.position_in_unique_constraint IS NOT NULL",
64
-                    [ $catalog, $main, $main ]
64
+                    [$catalog, $main, $main]
65 65
                 )
66 66
             )->toArray();
67 67
             foreach ($col as $row) {
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
                 if ($row['referenced_table_schema'] !== $main) {
72 72
                     $additional[] = $row['referenced_table_schema'];
73 73
                 }
74
-                $relationsT[$row['table_schema'] . '.' . $row['table_name']][] = $row;
75
-                $relationsR[$row['referenced_table_schema'] . '.' . $row['referenced_table_name']][] = $row;
74
+                $relationsT[$row['table_schema'].'.'.$row['table_name']][] = $row;
75
+                $relationsR[$row['referenced_table_schema'].'.'.$row['referenced_table_name']][] = $row;
76 76
             }
77 77
             foreach (array_filter(array_unique($additional)) as $s) {
78 78
                 $col = Collection::from(
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
                             (kc.table_schema = ? AND ct.table_schema = ?) AND
98 98
                             kc.table_name IS NOT NULL AND
99 99
                             kc.position_in_unique_constraint IS NOT NULL",
100
-                        [ $catalog, $s, $s ]
100
+                        [$catalog, $s, $s]
101 101
                     )
102 102
                 )->toArray();
103 103
                 foreach ($col as $row) {
104
-                    $relationsT[$row['table_schema'] . '.' . $row['table_name']][] = $row;
105
-                    $relationsR[$row['referenced_table_schema'] . '.' . $row['referenced_table_name']][] = $row;
104
+                    $relationsT[$row['table_schema'].'.'.$row['table_name']][] = $row;
105
+                    $relationsR[$row['referenced_table_schema'].'.'.$row['referenced_table_name']][] = $row;
106 106
                 }
107 107
             }
108 108
         }
@@ -110,12 +110,12 @@  discard block
 block discarded – undo
110 110
         $columns = Collection::from($this
111 111
             ->query(
112 112
                 "SELECT * FROM information_schema.columns WHERE table_name = ? AND table_schema = ? AND table_catalog = ?",
113
-                [ $table, $schema, $catalog ]
113
+                [$table, $schema, $catalog]
114 114
             ))
115
-            ->mapKey(function ($v) {
115
+            ->mapKey(function($v) {
116 116
                 return $v['column_name'];
117 117
             })
118
-            ->map(function ($v) {
118
+            ->map(function($v) {
119 119
                 $v['length'] = null;
120 120
                 if (!isset($v['data_type'])) {
121 121
                     return $v;
@@ -123,20 +123,20 @@  discard block
 block discarded – undo
123 123
                 switch ($v['data_type']) {
124 124
                     case 'character':
125 125
                     case 'character varying':
126
-                        $v['length'] = (int)$v['character_maximum_length'];
126
+                        $v['length'] = (int) $v['character_maximum_length'];
127 127
                         break;
128 128
                 }
129 129
                 return $v;
130 130
             })
131 131
             ->toArray();
132 132
         if (!count($columns)) {
133
-            throw new DBException('Table not found by name: ' . implode('.', [$schema,$table]));
133
+            throw new DBException('Table not found by name: '.implode('.', [$schema, $table]));
134 134
         }
135 135
         $pkname = Collection::from($this
136 136
             ->query(
137 137
                 "SELECT constraint_name FROM information_schema.table_constraints
138 138
                 WHERE table_name = ? AND constraint_type = ? AND table_schema = ? AND table_catalog = ?",
139
-                [ $table, 'PRIMARY KEY', $schema, $catalog ]
139
+                [$table, 'PRIMARY KEY', $schema, $catalog]
140 140
             ))
141 141
             ->pluck('constraint_name')
142 142
             ->value();
@@ -146,12 +146,12 @@  discard block
 block discarded – undo
146 146
                 ->query(
147 147
                     "SELECT column_name FROM information_schema.constraint_column_usage
148 148
                      WHERE table_name = ? AND constraint_name = ? AND table_schema = ? AND table_catalog = ?",
149
-                    [ $table, $pkname, $schema, $catalog ]
149
+                    [$table, $pkname, $schema, $catalog]
150 150
                 ))
151 151
                 ->pluck('column_name')
152 152
                 ->toArray();
153 153
         }
154
-        $tables[$schema . '.' .$table] = $definition = (new Table($table, $schema))
154
+        $tables[$schema.'.'.$table] = $definition = (new Table($table, $schema))
155 155
             ->addColumns($columns)
156 156
             ->setPrimaryKey($primary)
157 157
             ->setComment('');
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
             // assuming current table is on the "one" end having "many" records in the referencing table
162 162
             // resulting in a "hasMany" or "manyToMany" relationship (if a pivot table is detected)
163 163
             $relations = [];
164
-            foreach ($relationsR[$schema . '.' . $table] ?? [] as $relation) {
165
-                $relations[$relation['constraint_name']]['table'] = $relation['table_schema'] . '.' . $relation['table_name'];
164
+            foreach ($relationsR[$schema.'.'.$table] ?? [] as $relation) {
165
+                $relations[$relation['constraint_name']]['table'] = $relation['table_schema'].'.'.$relation['table_name'];
166 166
                 $relations[$relation['constraint_name']]['keymap'][$relation['referenced_column_name']] =
167 167
                     $relation['column_name'];
168 168
             }
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
                 $usedcol = [];
179 179
                 if (count($columns)) {
180 180
                     foreach (Collection::from($relationsT[$data['table']] ?? [])
181
-                        ->filter(function ($v) use ($columns) {
181
+                        ->filter(function($v) use ($columns) {
182 182
                             return in_array($v['column_name'], $columns);
183 183
                         }) as $relation
184 184
                     ) {
185
-                        $foreign[$relation['constraint_name']]['table'] = $relation['referenced_table_schema'] . '.' . $relation['referenced_table_name'];
185
+                        $foreign[$relation['constraint_name']]['table'] = $relation['referenced_table_schema'].'.'.$relation['referenced_table_name'];
186 186
                         $foreign[$relation['constraint_name']]['keymap'][$relation['column_name']] =
187 187
                             $relation['referenced_column_name'];
188 188
                         $usedcol[] = $relation['column_name'];
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
                     $orig = $relname;
199 199
                     $cntr = 1;
200 200
                     while ($definition->hasRelation($relname) || $definition->getName() == $relname) {
201
-                        $relname = $orig . '_' . (++ $cntr);
201
+                        $relname = $orig.'_'.(++$cntr);
202 202
                     }
203 203
                     $definition->addRelation(
204 204
                         new TableRelation(
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
                     $orig = $relname;
220 220
                     $cntr = 1;
221 221
                     while ($definition->hasRelation($relname) || $definition->getName() == $relname) {
222
-                        $relname = $orig . '_' . (++ $cntr);
222
+                        $relname = $orig.'_'.(++$cntr);
223 223
                     }
224 224
                     $definition->addRelation(
225 225
                         new TableRelation(
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
             // assuming current table is linked to "one" record in the referenced table
236 236
             // resulting in a "belongsTo" relationship
237 237
             $relations = [];
238
-            foreach ($relationsT[$schema . '.' . $table] ?? [] as $relation) {
239
-                $relations[$relation['constraint_name']]['table'] = $relation['referenced_table_schema'] . '.' . $relation['referenced_table_name'];
238
+            foreach ($relationsT[$schema.'.'.$table] ?? [] as $relation) {
239
+                $relations[$relation['constraint_name']]['table'] = $relation['referenced_table_schema'].'.'.$relation['referenced_table_name'];
240 240
                 $relations[$relation['constraint_name']]['keymap'][$relation['column_name']] =
241 241
                     $relation['referenced_column_name'];
242 242
             }
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
                 $orig = $relname;
250 250
                 $cntr = 1;
251 251
                 while ($definition->hasRelation($relname) || $definition->getName() == $relname) {
252
-                    $relname = $orig . '_' . (++ $cntr);
252
+                    $relname = $orig.'_'.(++$cntr);
253 253
                 }
254 254
                 $definition->addRelation(
255 255
                     new TableRelation(
@@ -268,19 +268,19 @@  discard block
 block discarded – undo
268 268
         $tables = Collection::from($this
269 269
             ->query(
270 270
                 "SELECT table_name FROM information_schema.tables where table_schema = ? AND table_catalog = ?",
271
-                [ $this->connection['opts']['schema'] ?? 'public', $this->connection['name'] ]
271
+                [$this->connection['opts']['schema'] ?? 'public', $this->connection['name']]
272 272
             ))
273
-            ->mapKey(function ($v) {
273
+            ->mapKey(function($v) {
274 274
                 return $v['table_name'];
275 275
             })
276 276
             ->pluck('table_name')
277
-            ->map(function ($v) {
277
+            ->map(function($v) {
278 278
                 return $this->table($v);
279 279
             })
280 280
             ->toArray();
281 281
 
282 282
         foreach (array_keys($tables) as $k) {
283
-            $tables[($this->connection['opts']['schema'] ?? 'public') . '.' . $k] = &$tables[$k];
283
+            $tables[($this->connection['opts']['schema'] ?? 'public').'.'.$k] = &$tables[$k];
284 284
         }
285 285
         return $tables;
286 286
     }
Please login to merge, or discard this patch.
src/driver/mysql/Schema.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
             $table = $temp[1];
29 29
         }
30 30
 
31
-        if (isset($tables[$schema . '.' . $table])) {
32
-            return $tables[$schema . '.' . $table];
31
+        if (isset($tables[$schema.'.'.$table])) {
32
+            return $tables[$schema.'.'.$table];
33 33
         }
34 34
 
35 35
         static $comments = [];
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
             $comments[$schema] = Collection::from(
38 38
                 $this->query(
39 39
                     "SELECT TABLE_NAME, TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = ?",
40
-                    [ $schema ]
40
+                    [$schema]
41 41
                 )
42 42
             )
43
-            ->mapKey(function ($v) {
43
+            ->mapKey(function($v) {
44 44
                 return $v['TABLE_NAME'];
45 45
             })
46 46
             ->pluck('TABLE_COMMENT')
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
                      WHERE
61 61
                         (TABLE_SCHEMA = ? OR REFERENCED_TABLE_SCHEMA = ?) AND
62 62
                         TABLE_NAME IS NOT NULL AND REFERENCED_TABLE_NAME IS NOT NULL",
63
-                    [ $main, $main ]
63
+                    [$main, $main]
64 64
                 )
65 65
             )->toArray();
66 66
             foreach ($col as $row) {
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
                 if ($row['REFERENCED_TABLE_SCHEMA'] !== $main) {
71 71
                     $additional[] = $row['REFERENCED_TABLE_SCHEMA'];
72 72
                 }
73
-                $relationsT[$row['TABLE_SCHEMA'] . '.' . $row['TABLE_NAME']][] = $row;
74
-                $relationsR[$row['REFERENCED_TABLE_SCHEMA'] . '.' . $row['REFERENCED_TABLE_NAME']][] = $row;
73
+                $relationsT[$row['TABLE_SCHEMA'].'.'.$row['TABLE_NAME']][] = $row;
74
+                $relationsR[$row['REFERENCED_TABLE_SCHEMA'].'.'.$row['REFERENCED_TABLE_NAME']][] = $row;
75 75
             }
76 76
             foreach (array_filter(array_unique($additional)) as $s) {
77 77
                 $col = Collection::from(
@@ -81,12 +81,12 @@  discard block
 block discarded – undo
81 81
                         WHERE
82 82
                             TABLE_SCHEMA = ? AND REFERENCED_TABLE_SCHEMA = ? AND
83 83
                             TABLE_NAME IS NOT NULL AND REFERENCED_TABLE_NAME IS NOT NULL",
84
-                        [ $s, $s ]
84
+                        [$s, $s]
85 85
                     )
86 86
                 )->toArray();
87 87
                 foreach ($col as $row) {
88
-                    $relationsT[$row['TABLE_SCHEMA'] . '.' . $row['TABLE_NAME']][] = $row;
89
-                    $relationsR[$row['REFERENCED_TABLE_SCHEMA'] . '.' . $row['REFERENCED_TABLE_NAME']][] = $row;
88
+                    $relationsT[$row['TABLE_SCHEMA'].'.'.$row['TABLE_NAME']][] = $row;
89
+                    $relationsR[$row['REFERENCED_TABLE_SCHEMA'].'.'.$row['REFERENCED_TABLE_NAME']][] = $row;
90 90
                 }
91 91
             }
92 92
         }
@@ -95,14 +95,14 @@  discard block
 block discarded – undo
95 95
         if (!count($columns)) {
96 96
             throw new DBException('Table not found by name');
97 97
         }
98
-        $tables[$schema . '.' . $table] = $definition = (new Table($table, $schema))
98
+        $tables[$schema.'.'.$table] = $definition = (new Table($table, $schema))
99 99
             ->addColumns(
100 100
                 $columns
101 101
                     ->clone()
102
-                    ->mapKey(function ($v) {
102
+                    ->mapKey(function($v) {
103 103
                         return $v['Field'];
104 104
                     })
105
-                    ->map(function ($v) {
105
+                    ->map(function($v) {
106 106
                         $v['length'] = null;
107 107
                         if (!isset($v['Type'])) {
108 108
                             return $v;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
                             default:
125 125
                                 if (strpos($type, 'char') !== false && strpos($type, '(') !== false) {
126 126
                                     // extract length from varchar
127
-                                    $v['length'] = (int)explode(')', explode('(', $type)[1])[0];
127
+                                    $v['length'] = (int) explode(')', explode('(', $type)[1])[0];
128 128
                                     $v['length'] = $v['length'] > 0 ? $v['length'] : null;
129 129
                                 }
130 130
                                 break;
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
             ->setPrimaryKey(
137 137
                 $columns
138 138
                     ->clone()
139
-                    ->filter(function ($v) {
139
+                    ->filter(function($v) {
140 140
                         return $v['Key'] === 'PRI';
141 141
                     })
142 142
                     ->pluck('Field')
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
             // assuming current table is on the "one" end having "many" records in the referencing table
151 151
             // resulting in a "hasMany" or "manyToMany" relationship (if a pivot table is detected)
152 152
             $relations = [];
153
-            foreach ($relationsR[$schema . '.' . $table] ?? [] as $relation) {
154
-                $relations[$relation['CONSTRAINT_NAME']]['table'] = $relation['TABLE_SCHEMA'] . '.' . $relation['TABLE_NAME'];
153
+            foreach ($relationsR[$schema.'.'.$table] ?? [] as $relation) {
154
+                $relations[$relation['CONSTRAINT_NAME']]['table'] = $relation['TABLE_SCHEMA'].'.'.$relation['TABLE_NAME'];
155 155
                 $relations[$relation['CONSTRAINT_NAME']]['keymap'][$relation['REFERENCED_COLUMN_NAME']] =
156 156
                     $relation['COLUMN_NAME'];
157 157
             }
@@ -167,10 +167,10 @@  discard block
 block discarded – undo
167 167
                 $usedcol = [];
168 168
                 if (count($columns)) {
169 169
                     foreach (Collection::from($relationsT[$data['table']] ?? [])
170
-                        ->filter(function ($v) use ($columns) {
170
+                        ->filter(function($v) use ($columns) {
171 171
                             return in_array($v['COLUMN_NAME'], $columns);
172 172
                         })
173
-                        ->map(function ($v) {
173
+                        ->map(function($v) {
174 174
                             $new = [];
175 175
                             foreach ($v as $kk => $vv) {
176 176
                                 $new[strtoupper($kk)] = $vv;
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
                             return $new;
179 179
                         }) as $relation
180 180
                     ) {
181
-                        $foreign[$relation['CONSTRAINT_NAME']]['table'] = $relation['REFERENCED_TABLE_SCHEMA'] . '.' . $relation['REFERENCED_TABLE_NAME'];
181
+                        $foreign[$relation['CONSTRAINT_NAME']]['table'] = $relation['REFERENCED_TABLE_SCHEMA'].'.'.$relation['REFERENCED_TABLE_NAME'];
182 182
                         $foreign[$relation['CONSTRAINT_NAME']]['keymap'][$relation['COLUMN_NAME']] =
183 183
                             $relation['REFERENCED_COLUMN_NAME'];
184 184
                         $usedcol[] = $relation['COLUMN_NAME'];
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
                     $orig = $relname;
195 195
                     $cntr = 1;
196 196
                     while ($definition->hasRelation($relname) || $definition->getName() == $relname) {
197
-                        $relname = $orig . '_' . (++ $cntr);
197
+                        $relname = $orig.'_'.(++$cntr);
198 198
                     }
199 199
                     $definition->addRelation(
200 200
                         new TableRelation(
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
                     $orig = $relname;
216 216
                     $cntr = 1;
217 217
                     while ($definition->hasRelation($relname) || $definition->getName() == $relname) {
218
-                        $relname = $orig . '_' . (++ $cntr);
218
+                        $relname = $orig.'_'.(++$cntr);
219 219
                     }
220 220
                     $definition->addRelation(
221 221
                         new TableRelation(
@@ -231,8 +231,8 @@  discard block
 block discarded – undo
231 231
             // assuming current table is linked to "one" record in the referenced table
232 232
             // resulting in a "belongsTo" relationship
233 233
             $relations = [];
234
-            foreach (Collection::from($relationsT[$schema . '.' . $table] ?? [])
235
-                ->map(function ($v) {
234
+            foreach (Collection::from($relationsT[$schema.'.'.$table] ?? [])
235
+                ->map(function($v) {
236 236
                     $new = [];
237 237
                     foreach ($v as $kk => $vv) {
238 238
                         $new[strtoupper($kk)] = $vv;
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
                     return $new;
241 241
                 }) as $relation
242 242
             ) {
243
-                $relations[$relation['CONSTRAINT_NAME']]['table'] = $relation['REFERENCED_TABLE_SCHEMA'] . '.' . $relation['REFERENCED_TABLE_NAME'];
243
+                $relations[$relation['CONSTRAINT_NAME']]['table'] = $relation['REFERENCED_TABLE_SCHEMA'].'.'.$relation['REFERENCED_TABLE_NAME'];
244 244
                 $relations[$relation['CONSTRAINT_NAME']]['keymap'][$relation['COLUMN_NAME']] =
245 245
                     $relation['REFERENCED_COLUMN_NAME'];
246 246
             }
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
                 $orig = $relname;
254 254
                 $cntr = 1;
255 255
                 while ($definition->hasRelation($relname) || $definition->getName() == $relname) {
256
-                    $relname = $orig . '_' . (++ $cntr);
256
+                    $relname = $orig.'_'.(++$cntr);
257 257
                 }
258 258
                 $definition->addRelation(
259 259
                     new TableRelation(
@@ -274,23 +274,23 @@  discard block
 block discarded – undo
274 274
                 "SELECT table_name FROM information_schema.tables where table_schema = ?",
275 275
                 [$this->connection['opts']['schema'] ?? $this->connection['name']]
276 276
             ))
277
-            ->map(function ($v) {
277
+            ->map(function($v) {
278 278
                 $new = [];
279 279
                 foreach ($v as $kk => $vv) {
280 280
                     $new[strtoupper($kk)] = $vv;
281 281
                 }
282 282
                 return $new;
283 283
             })
284
-            ->mapKey(function ($v) {
284
+            ->mapKey(function($v) {
285 285
                 return $v['TABLE_NAME'];
286 286
             })
287 287
             ->pluck('TABLE_NAME')
288
-            ->map(function ($v) {
288
+            ->map(function($v) {
289 289
                 return $this->table($v);
290 290
             })
291 291
             ->toArray();
292 292
         foreach (array_keys($tables) as $k) {
293
-            $tables[($this->connection['opts']['schema'] ?? $this->connection['name']) . '.' . $k] = &$tables[$k];
293
+            $tables[($this->connection['opts']['schema'] ?? $this->connection['name']).'.'.$k] = &$tables[$k];
294 294
         }
295 295
         return $tables;
296 296
     }
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/postgre/Driver.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -76,11 +76,11 @@
 block discarded – undo
76 76
         $res = \pg_query($this->lnk, $sql);
77 77
         if ($log) {
78 78
             $tm = microtime(true) - $tm;
79
-            if ($tm >= (float)$this->option('log_slow', 0)) {
79
+            if ($tm >= (float) $this->option('log_slow', 0)) {
80 80
                 @file_put_contents(
81 81
                     $log,
82
-                    '--' . date('Y-m-d H:i:s') . ' ' . sprintf('%01.6f', $tm) . "s\r\n" .
83
-                    $sql . "\r\n" .
82
+                    '--'.date('Y-m-d H:i:s').' '.sprintf('%01.6f', $tm)."s\r\n".
83
+                    $sql."\r\n".
84 84
                     "\r\n",
85 85
                     FILE_APPEND
86 86
                 );
Please login to merge, or discard this patch.
src/driver/postgre/Statement.php 1 patch
Spacing   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,14 +29,13 @@  discard block
 block discarded – undo
29 29
             $tm = microtime(true);
30 30
         }
31 31
         $temp = (is_array($data) && count($data)) ?
32
-            \pg_query_params($this->driver, $this->statement, $data) :
33
-            \pg_query_params($this->driver, $this->statement, array());
32
+            \pg_query_params($this->driver, $this->statement, $data) : \pg_query_params($this->driver, $this->statement, array());
34 33
         if (!$temp) {
35
-            if ($log && (int)$this->drv->option('log_errors', 1)) {
34
+            if ($log && (int) $this->drv->option('log_errors', 1)) {
36 35
                 @file_put_contents(
37 36
                     $log,
38
-                    '--' . date('Y-m-d H:i:s') . ' ERROR: ' . \pg_last_error($this->driver) . "\r\n" .
39
-                    $this->statement . "\r\n" .
37
+                    '--'.date('Y-m-d H:i:s').' ERROR: '.\pg_last_error($this->driver)."\r\n".
38
+                    $this->statement."\r\n".
40 39
                     "\r\n",
41 40
                     FILE_APPEND
42 41
                 );
@@ -45,11 +44,11 @@  discard block
 block discarded – undo
45 44
         }
46 45
         if ($log) {
47 46
             $tm = microtime(true) - $tm;
48
-            if ($tm >= (float)$this->drv->option('log_slow', 0)) {
47
+            if ($tm >= (float) $this->drv->option('log_slow', 0)) {
49 48
                 @file_put_contents(
50 49
                     $log,
51
-                    '--' . date('Y-m-d H:i:s') . ' ' . sprintf('%01.6f', $tm) . "s\r\n" .
52
-                    $this->statement . "\r\n" .
50
+                    '--'.date('Y-m-d H:i:s').' '.sprintf('%01.6f', $tm)."s\r\n".
51
+                    $this->statement."\r\n".
53 52
                     "\r\n",
54 53
                     FILE_APPEND
55 54
                 );
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.