@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $fields = []; |
| 71 | 71 | $exists = false; |
| 72 | 72 | foreach ($relation->table->getColumns() as $column) { |
| 73 | - $nm = $name . static::SEP . $column; |
|
| 73 | + $nm = $name.static::SEP.$column; |
|
| 74 | 74 | if (isset($this->aliases[$nm])) { |
| 75 | 75 | $nm = $this->aliases[$nm]; |
| 76 | 76 | } |
@@ -84,16 +84,16 @@ discard block |
||
| 84 | 84 | $parts = explode(static::SEP, $name); |
| 85 | 85 | $name = array_pop($parts); |
| 86 | 86 | if (!$exists && !count($parts) && !isset($temp[$name])) { |
| 87 | - $temp[$name] = $relation->many ? [ '___clean' => true ] : null; |
|
| 87 | + $temp[$name] = $relation->many ? ['___clean' => true] : null; |
|
| 88 | 88 | } |
| 89 | 89 | if ($exists) { |
| 90 | - $full = ''; |
|
| 90 | + $full = ''; |
|
| 91 | 91 | foreach ($parts as $item) { |
| 92 | - $full = $full ? $full . static::SEP . $item : $item; |
|
| 92 | + $full = $full ? $full.static::SEP.$item : $item; |
|
| 93 | 93 | $temp = &$temp[$item]; |
| 94 | 94 | $rpk = []; |
| 95 | 95 | foreach ($this->relations[$full][0]->table->getPrimaryKey() as $pkey) { |
| 96 | - $nm = $full . static::SEP . $pkey; |
|
| 96 | + $nm = $full.static::SEP.$pkey; |
|
| 97 | 97 | if (isset($this->aliases[$nm])) { |
| 98 | 98 | $nm = $this->aliases[$nm]; |
| 99 | 99 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $temp = &$temp[json_encode($rpk)]; |
| 103 | 103 | } |
| 104 | 104 | if (!isset($temp[$name])) { |
| 105 | - $temp[$name] = $relation->many ? [ '___clean' => true ] : null; |
|
| 105 | + $temp[$name] = $relation->many ? ['___clean' => true] : null; |
|
| 106 | 106 | } |
| 107 | 107 | $temp = &$temp[$name]; |
| 108 | 108 | if ($relation->many) { |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | return; |
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | - $this->fetched ++; |
|
| 163 | + $this->fetched++; |
|
| 164 | 164 | while ($this->result->valid()) { |
| 165 | 165 | $row = $this->result->current(); |
| 166 | 166 | $pk = []; |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | $instance->setLength($data['length']); |
| 52 | 52 | } |
| 53 | 53 | if ($instance->getBasicType() === 'enum' && strpos($instance->getType(), 'enum(') === 0) { |
| 54 | - $temp = array_map(function ($v) { |
|
| 54 | + $temp = array_map(function($v) { |
|
| 55 | 55 | return str_replace("''", "'", $v); |
| 56 | 56 | }, explode("','", substr($instance->getType(), 6, -2))); |
| 57 | 57 | $instance->setValues($temp); |
@@ -24,28 +24,28 @@ |
||
| 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 | } |
@@ -90,7 +90,7 @@ |
||
| 90 | 90 | |
| 91 | 91 | public function begin() : bool |
| 92 | 92 | { |
| 93 | - return $this->transaction = true; |
|
| 93 | + return $this->transaction = true; |
|
| 94 | 94 | } |
| 95 | 95 | public function commit() : bool |
| 96 | 96 | { |
@@ -37,7 +37,7 @@ |
||
| 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'], |
@@ -124,7 +124,7 @@ |
||
| 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]] = |
@@ -29,19 +29,19 @@ discard block |
||
| 29 | 29 | $columns = Collection::from($this |
| 30 | 30 | ->query( |
| 31 | 31 | "SELECT * FROM all_tab_cols WHERE table_name = ? AND owner = ?", |
| 32 | - [ strtoupper($table), $this->name() ] |
|
| 32 | + [strtoupper($table), $this->name()] |
|
| 33 | 33 | )) |
| 34 | - ->map(function ($v) { |
|
| 34 | + ->map(function($v) { |
|
| 35 | 35 | $new = []; |
| 36 | 36 | foreach ($v as $kk => $vv) { |
| 37 | 37 | $new[strtoupper($kk)] = $vv; |
| 38 | 38 | } |
| 39 | 39 | return $new; |
| 40 | 40 | }) |
| 41 | - ->mapKey(function ($v) { |
|
| 41 | + ->mapKey(function($v) { |
|
| 42 | 42 | return $v['COLUMN_NAME']; |
| 43 | 43 | }) |
| 44 | - ->map(function ($v) { |
|
| 44 | + ->map(function($v) { |
|
| 45 | 45 | $v['length'] = null; |
| 46 | 46 | if (!isset($v['DATA_TYPE'])) { |
| 47 | 47 | return $v; |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | default: |
| 54 | 54 | if (strpos($type, 'char') !== false && strpos($type, '(') !== false) { |
| 55 | 55 | // extract length from varchar |
| 56 | - $v['length'] = (int)explode(')', (explode('(', $type)[1] ?? ''))[0]; |
|
| 56 | + $v['length'] = (int) explode(')', (explode('(', $type)[1] ?? ''))[0]; |
|
| 57 | 57 | $v['length'] = $v['length'] > 0 ? $v['length'] : null; |
| 58 | 58 | } |
| 59 | 59 | break; |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | ->query( |
| 70 | 70 | "SELECT constraint_name FROM all_constraints |
| 71 | 71 | WHERE table_name = ? AND constraint_type = ? AND owner = ?", |
| 72 | - [ strtoupper($table), 'P', $owner ] |
|
| 72 | + [strtoupper($table), 'P', $owner] |
|
| 73 | 73 | )) |
| 74 | - ->map(function ($v) { |
|
| 74 | + ->map(function($v) { |
|
| 75 | 75 | $new = []; |
| 76 | 76 | foreach ($v as $kk => $vv) { |
| 77 | 77 | $new[strtoupper($kk)] = $vv; |
@@ -86,9 +86,9 @@ discard block |
||
| 86 | 86 | ->query( |
| 87 | 87 | "SELECT column_name FROM all_cons_columns |
| 88 | 88 | WHERE table_name = ? AND constraint_name = ? AND owner = ?", |
| 89 | - [ strtoupper($table), $pkname, $owner ] |
|
| 89 | + [strtoupper($table), $pkname, $owner] |
|
| 90 | 90 | )) |
| 91 | - ->map(function ($v) { |
|
| 91 | + ->map(function($v) { |
|
| 92 | 92 | $new = []; |
| 93 | 93 | foreach ($v as $kk => $vv) { |
| 94 | 94 | $new[strtoupper($kk)] = $vv; |
@@ -115,9 +115,9 @@ discard block |
||
| 115 | 115 | LEFT JOIN all_cons_columns cc ON cc.OWNER = ac.OWNER AND cc.CONSTRAINT_NAME = ac.CONSTRAINT_NAME |
| 116 | 116 | WHERE ac.OWNER = ? AND ac.R_OWNER = ? AND ac.R_CONSTRAINT_NAME = ? AND ac.CONSTRAINT_TYPE = ? |
| 117 | 117 | ORDER BY cc.POSITION", |
| 118 | - [ $owner, $owner, $pkname, 'R' ] |
|
| 118 | + [$owner, $owner, $pkname, 'R'] |
|
| 119 | 119 | )) |
| 120 | - ->map(function ($v) { |
|
| 120 | + ->map(function($v) { |
|
| 121 | 121 | $new = []; |
| 122 | 122 | foreach ($v as $kk => $vv) { |
| 123 | 123 | $new[strtoupper($kk)] = $vv; |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | as $relation |
| 128 | 128 | ) { |
| 129 | 129 | $relations[$relation['CONSTRAINT_NAME']]['table'] = $relation['TABLE_NAME']; |
| 130 | - $relations[$relation['CONSTRAINT_NAME']]['keymap'][$primary[(int)$relation['POSITION']-1]] = |
|
| 130 | + $relations[$relation['CONSTRAINT_NAME']]['keymap'][$primary[(int) $relation['POSITION'] - 1]] = |
|
| 131 | 131 | $relation['COLUMN_NAME']; |
| 132 | 132 | } |
| 133 | 133 | foreach ($relations as $data) { |
@@ -157,9 +157,9 @@ discard block |
||
| 157 | 157 | ac.OWNER = ? AND ac.R_OWNER = ? AND ac.TABLE_NAME = ? AND ac.CONSTRAINT_TYPE = ? AND |
| 158 | 158 | cc.COLUMN_NAME IN (??) |
| 159 | 159 | ORDER BY POSITION", |
| 160 | - [ $owner, $owner, $data['table'], 'R', $columns ] |
|
| 160 | + [$owner, $owner, $data['table'], 'R', $columns] |
|
| 161 | 161 | )) |
| 162 | - ->map(function ($v) { |
|
| 162 | + ->map(function($v) { |
|
| 163 | 163 | $new = []; |
| 164 | 164 | foreach ($v as $kk => $vv) { |
| 165 | 165 | $new[strtoupper($kk)] = $vv; |
@@ -179,9 +179,9 @@ discard block |
||
| 179 | 179 | ->query( |
| 180 | 180 | "SELECT COLUMN_NAME FROM all_cons_columns |
| 181 | 181 | WHERE OWNER = ? AND CONSTRAINT_NAME = ? ORDER BY POSITION", |
| 182 | - [ $owner, current($foreign['keymap']) ] |
|
| 182 | + [$owner, current($foreign['keymap'])] |
|
| 183 | 183 | )) |
| 184 | - ->map(function ($v) { |
|
| 184 | + ->map(function($v) { |
|
| 185 | 185 | $new = []; |
| 186 | 186 | foreach ($v as $kk => $vv) { |
| 187 | 187 | $new[strtoupper($kk)] = $vv; |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | $relname = $foreign['table']; |
| 197 | 197 | $cntr = 1; |
| 198 | 198 | while ($definition->hasRelation($relname) || $definition->getName() == $relname) { |
| 199 | - $relname = $foreign['table'] . '_' . (++ $cntr); |
|
| 199 | + $relname = $foreign['table'].'_'.(++$cntr); |
|
| 200 | 200 | } |
| 201 | 201 | $definition->addRelation( |
| 202 | 202 | new TableRelation( |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $relname = $data['table']; |
| 213 | 213 | $cntr = 1; |
| 214 | 214 | while ($definition->hasRelation($relname) || $definition->getName() == $relname) { |
| 215 | - $relname = $data['table'] . '_' . (++ $cntr); |
|
| 215 | + $relname = $data['table'].'_'.(++$cntr); |
|
| 216 | 216 | } |
| 217 | 217 | $definition->addRelation( |
| 218 | 218 | new TableRelation( |
@@ -240,9 +240,9 @@ discard block |
||
| 240 | 240 | LEFT JOIN all_cons_columns cc ON cc.OWNER = ac.OWNER AND cc.CONSTRAINT_NAME = ac.CONSTRAINT_NAME |
| 241 | 241 | WHERE ac.OWNER = ? AND ac.R_OWNER = ? AND ac.TABLE_NAME = ? AND ac.CONSTRAINT_TYPE = ? |
| 242 | 242 | ORDER BY cc.POSITION", |
| 243 | - [ $owner, $owner, strtoupper($table), 'R' ] |
|
| 243 | + [$owner, $owner, strtoupper($table), 'R'] |
|
| 244 | 244 | )) |
| 245 | - ->map(function ($v) { |
|
| 245 | + ->map(function($v) { |
|
| 246 | 246 | $new = []; |
| 247 | 247 | foreach ($v as $kk => $vv) { |
| 248 | 248 | $new[strtoupper($kk)] = $vv; |
@@ -260,9 +260,9 @@ discard block |
||
| 260 | 260 | ->query( |
| 261 | 261 | "SELECT COLUMN_NAME FROM all_cons_columns |
| 262 | 262 | WHERE OWNER = ? AND CONSTRAINT_NAME = ? ORDER BY POSITION", |
| 263 | - [ $owner, current($data['keymap']) ] |
|
| 263 | + [$owner, current($data['keymap'])] |
|
| 264 | 264 | )) |
| 265 | - ->map(function ($v) { |
|
| 265 | + ->map(function($v) { |
|
| 266 | 266 | $new = []; |
| 267 | 267 | foreach ($v as $kk => $vv) { |
| 268 | 268 | $new[strtoupper($kk)] = $vv; |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | $relname = $data['table']; |
| 278 | 278 | $cntr = 1; |
| 279 | 279 | while ($definition->hasRelation($relname) || $definition->getName() == $relname) { |
| 280 | - $relname = $data['table'] . '_' . (++ $cntr); |
|
| 280 | + $relname = $data['table'].'_'.(++$cntr); |
|
| 281 | 281 | } |
| 282 | 282 | $definition->addRelation( |
| 283 | 283 | new TableRelation( |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | "SELECT TABLE_NAME FROM ALL_TABLES where OWNER = ?", |
| 299 | 299 | [$this->connection['name']] |
| 300 | 300 | )) |
| 301 | - ->map(function ($v) { |
|
| 301 | + ->map(function($v) { |
|
| 302 | 302 | $new = []; |
| 303 | 303 | foreach ($v as $kk => $vv) { |
| 304 | 304 | $new[strtoupper($kk)] = $vv; |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | return $new; |
| 307 | 307 | }) |
| 308 | 308 | ->pluck('TABLE_NAME') |
| 309 | - ->map(function ($v) { |
|
| 309 | + ->map(function($v) { |
|
| 310 | 310 | return $this->table($v); |
| 311 | 311 | }) |
| 312 | 312 | ->toArray(); |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | kc.table_schema = ? AND |
| 48 | 48 | kc.table_name IS NOT NULL AND |
| 49 | 49 | kc.position_in_unique_constraint IS NOT NULL", |
| 50 | - [ $this->connection['opts']['schema'] ?? $this->connection['name'] ] |
|
| 50 | + [$this->connection['opts']['schema'] ?? $this->connection['name']] |
|
| 51 | 51 | ) |
| 52 | 52 | )->toArray(); |
| 53 | 53 | foreach ($col as $row) { |
@@ -59,12 +59,12 @@ discard block |
||
| 59 | 59 | $columns = Collection::from($this |
| 60 | 60 | ->query( |
| 61 | 61 | "SELECT * FROM information_schema.columns WHERE table_name = ? AND table_schema = ?", |
| 62 | - [ $table, $this->connection['opts']['schema'] ?? $this->connection['name'] ] |
|
| 62 | + [$table, $this->connection['opts']['schema'] ?? $this->connection['name']] |
|
| 63 | 63 | )) |
| 64 | - ->mapKey(function ($v) { |
|
| 64 | + ->mapKey(function($v) { |
|
| 65 | 65 | return $v['column_name']; |
| 66 | 66 | }) |
| 67 | - ->map(function ($v) { |
|
| 67 | + ->map(function($v) { |
|
| 68 | 68 | $v['length'] = null; |
| 69 | 69 | if (!isset($v['data_type'])) { |
| 70 | 70 | return $v; |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | switch ($v['data_type']) { |
| 73 | 73 | case 'character': |
| 74 | 74 | case 'character varying': |
| 75 | - $v['length'] = (int)$v['character_maximum_length']; |
|
| 75 | + $v['length'] = (int) $v['character_maximum_length']; |
|
| 76 | 76 | break; |
| 77 | 77 | } |
| 78 | 78 | return $v; |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | ->query( |
| 86 | 86 | "SELECT constraint_name FROM information_schema.table_constraints |
| 87 | 87 | WHERE table_name = ? AND constraint_type = ? AND table_schema = ?", |
| 88 | - [ $table, 'PRIMARY KEY', $this->connection['opts']['schema'] ?? $this->connection['name'] ] |
|
| 88 | + [$table, 'PRIMARY KEY', $this->connection['opts']['schema'] ?? $this->connection['name']] |
|
| 89 | 89 | )) |
| 90 | 90 | ->pluck('constraint_name') |
| 91 | 91 | ->value(); |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | ->query( |
| 96 | 96 | "SELECT column_name FROM information_schema.constraint_column_usage |
| 97 | 97 | WHERE table_name = ? AND constraint_name = ? AND table_schema = ?", |
| 98 | - [ $table, $pkname, $this->connection['opts']['schema'] ?? $this->connection['name'] ] |
|
| 98 | + [$table, $pkname, $this->connection['opts']['schema'] ?? $this->connection['name']] |
|
| 99 | 99 | )) |
| 100 | 100 | ->pluck('column_name') |
| 101 | 101 | ->toArray(); |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | $usedcol = []; |
| 128 | 128 | if (count($columns)) { |
| 129 | 129 | foreach (Collection::from($relationsT[$data['table']] ?? []) |
| 130 | - ->filter(function ($v) use ($columns) { |
|
| 130 | + ->filter(function($v) use ($columns) { |
|
| 131 | 131 | return in_array($v['column_name'], $columns); |
| 132 | 132 | }) as $relation |
| 133 | 133 | ) { |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $relname = $foreign['table']; |
| 143 | 143 | $cntr = 1; |
| 144 | 144 | while ($definition->hasRelation($relname) || $definition->getName() == $relname) { |
| 145 | - $relname = $foreign['table'] . '_' . (++ $cntr); |
|
| 145 | + $relname = $foreign['table'].'_'.(++$cntr); |
|
| 146 | 146 | } |
| 147 | 147 | $definition->addRelation( |
| 148 | 148 | new TableRelation( |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | $relname = $data['table']; |
| 159 | 159 | $cntr = 1; |
| 160 | 160 | while ($definition->hasRelation($relname) || $definition->getName() == $relname) { |
| 161 | - $relname = $data['table'] . '_' . (++ $cntr); |
|
| 161 | + $relname = $data['table'].'_'.(++$cntr); |
|
| 162 | 162 | } |
| 163 | 163 | $definition->addRelation( |
| 164 | 164 | new TableRelation( |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | $relname = $data['table']; |
| 184 | 184 | $cntr = 1; |
| 185 | 185 | while ($definition->hasRelation($relname) || $definition->getName() == $relname) { |
| 186 | - $relname = $data['table'] . '_' . (++ $cntr); |
|
| 186 | + $relname = $data['table'].'_'.(++$cntr); |
|
| 187 | 187 | } |
| 188 | 188 | $definition->addRelation( |
| 189 | 189 | new TableRelation( |
@@ -202,10 +202,10 @@ discard block |
||
| 202 | 202 | return Collection::from($this |
| 203 | 203 | ->query( |
| 204 | 204 | "SELECT table_name FROM information_schema.tables where table_schema = ?", |
| 205 | - [ $this->connection['opts']['schema'] ?? $this->connection['name'] ] |
|
| 205 | + [$this->connection['opts']['schema'] ?? $this->connection['name']] |
|
| 206 | 206 | )) |
| 207 | 207 | ->pluck('table_name') |
| 208 | - ->map(function ($v) { |
|
| 208 | + ->map(function($v) { |
|
| 209 | 209 | return $this->table($v); |
| 210 | 210 | }) |
| 211 | 211 | ->toArray(); |
@@ -28,10 +28,10 @@ discard block |
||
| 28 | 28 | $comments = Collection::from( |
| 29 | 29 | $this->query( |
| 30 | 30 | "SELECT TABLE_NAME, TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = ?", |
| 31 | - [ $this->connection['opts']['schema'] ?? $this->connection['name'] ] |
|
| 31 | + [$this->connection['opts']['schema'] ?? $this->connection['name']] |
|
| 32 | 32 | ) |
| 33 | 33 | ) |
| 34 | - ->mapKey(function ($v) { |
|
| 34 | + ->mapKey(function($v) { |
|
| 35 | 35 | return $v['TABLE_NAME']; |
| 36 | 36 | }) |
| 37 | 37 | ->pluck('TABLE_COMMENT') |
@@ -71,10 +71,10 @@ discard block |
||
| 71 | 71 | ->addColumns( |
| 72 | 72 | $columns |
| 73 | 73 | ->clone() |
| 74 | - ->mapKey(function ($v) { |
|
| 74 | + ->mapKey(function($v) { |
|
| 75 | 75 | return $v['Field']; |
| 76 | 76 | }) |
| 77 | - ->map(function ($v) { |
|
| 77 | + ->map(function($v) { |
|
| 78 | 78 | $v['length'] = null; |
| 79 | 79 | if (!isset($v['Type'])) { |
| 80 | 80 | return $v; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | default: |
| 97 | 97 | if (strpos($type, 'char') !== false && strpos($type, '(') !== false) { |
| 98 | 98 | // extract length from varchar |
| 99 | - $v['length'] = (int)explode(')', explode('(', $type)[1])[0]; |
|
| 99 | + $v['length'] = (int) explode(')', explode('(', $type)[1])[0]; |
|
| 100 | 100 | $v['length'] = $v['length'] > 0 ? $v['length'] : null; |
| 101 | 101 | } |
| 102 | 102 | break; |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | ->setPrimaryKey( |
| 109 | 109 | $columns |
| 110 | 110 | ->clone() |
| 111 | - ->filter(function ($v) { |
|
| 111 | + ->filter(function($v) { |
|
| 112 | 112 | return $v['Key'] === 'PRI'; |
| 113 | 113 | }) |
| 114 | 114 | ->pluck('Field') |
@@ -138,10 +138,10 @@ discard block |
||
| 138 | 138 | $usedcol = []; |
| 139 | 139 | if (count($columns)) { |
| 140 | 140 | foreach (Collection::from($relationsT[$data['table']] ?? []) |
| 141 | - ->filter(function ($v) use ($columns) { |
|
| 141 | + ->filter(function($v) use ($columns) { |
|
| 142 | 142 | return in_array($v['COLUMN_NAME'], $columns); |
| 143 | 143 | }) |
| 144 | - ->map(function ($v) { |
|
| 144 | + ->map(function($v) { |
|
| 145 | 145 | $new = []; |
| 146 | 146 | foreach ($v as $kk => $vv) { |
| 147 | 147 | $new[strtoupper($kk)] = $vv; |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | $relname = $foreign['table']; |
| 161 | 161 | $cntr = 1; |
| 162 | 162 | while ($definition->hasRelation($relname) || $definition->getName() == $relname) { |
| 163 | - $relname = $foreign['table'] . '_' . (++ $cntr); |
|
| 163 | + $relname = $foreign['table'].'_'.(++$cntr); |
|
| 164 | 164 | } |
| 165 | 165 | $definition->addRelation( |
| 166 | 166 | new TableRelation( |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | $relname = $data['table']; |
| 177 | 177 | $cntr = 1; |
| 178 | 178 | while ($definition->hasRelation($relname) || $definition->getName() == $relname) { |
| 179 | - $relname = $data['table'] . '_' . (++ $cntr); |
|
| 179 | + $relname = $data['table'].'_'.(++$cntr); |
|
| 180 | 180 | } |
| 181 | 181 | $definition->addRelation( |
| 182 | 182 | new TableRelation( |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | // resulting in a "belongsTo" relationship |
| 194 | 194 | $relations = []; |
| 195 | 195 | foreach (Collection::from($relationsT[$table] ?? []) |
| 196 | - ->map(function ($v) { |
|
| 196 | + ->map(function($v) { |
|
| 197 | 197 | $new = []; |
| 198 | 198 | foreach ($v as $kk => $vv) { |
| 199 | 199 | $new[strtoupper($kk)] = $vv; |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | $relname = $data['table']; |
| 210 | 210 | $cntr = 1; |
| 211 | 211 | while ($definition->hasRelation($relname) || $definition->getName() == $relname) { |
| 212 | - $relname = $data['table'] . '_' . (++ $cntr); |
|
| 212 | + $relname = $data['table'].'_'.(++$cntr); |
|
| 213 | 213 | } |
| 214 | 214 | $definition->addRelation( |
| 215 | 215 | new TableRelation( |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | "SELECT table_name FROM information_schema.tables where table_schema = ?", |
| 231 | 231 | [$this->connection['opts']['schema'] ?? $this->connection['name']] |
| 232 | 232 | )) |
| 233 | - ->map(function ($v) { |
|
| 233 | + ->map(function($v) { |
|
| 234 | 234 | $new = []; |
| 235 | 235 | foreach ($v as $kk => $vv) { |
| 236 | 236 | $new[strtoupper($kk)] = $vv; |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | return $new; |
| 239 | 239 | }) |
| 240 | 240 | ->pluck('TABLE_NAME') |
| 241 | - ->map(function ($v) { |
|
| 241 | + ->map(function($v) { |
|
| 242 | 242 | return $this->table($v); |
| 243 | 243 | }) |
| 244 | 244 | ->toArray(); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | if ($temp) { |
| 30 | 30 | $temp = $temp->fetch_fields(); |
| 31 | 31 | if ($temp) { |
| 32 | - $columns = array_map(function ($v) { |
|
| 32 | + $columns = array_map(function($v) { |
|
| 33 | 33 | return $v->name; |
| 34 | 34 | }, $temp); |
| 35 | 35 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | public function current() |
| 72 | 72 | { |
| 73 | - return $this->nativeDriver ? $this->last : array_map(function ($v) { |
|
| 73 | + return $this->nativeDriver ? $this->last : array_map(function($v) { |
|
| 74 | 74 | return $v; |
| 75 | 75 | }, $this->row); |
| 76 | 76 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | public function next() |
| 91 | 91 | { |
| 92 | - $this->fetched ++; |
|
| 92 | + $this->fetched++; |
|
| 93 | 93 | $this->last = $this->nativeDriver ? $this->result->fetch_assoc() : $this->statement->fetch(); |
| 94 | 94 | } |
| 95 | 95 | public function valid() |