@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | { |
| 37 | 37 | if ($this->lnk === null) { |
| 38 | 38 | $this->lnk = new \mysqli( |
| 39 | - (isset($this->connection['opts']['persist']) && $this->connection['opts']['persist'] ? 'p:' : '') . |
|
| 39 | + (isset($this->connection['opts']['persist']) && $this->connection['opts']['persist'] ? 'p:' : ''). |
|
| 40 | 40 | $this->connection['host'], |
| 41 | 41 | $this->connection['user'], |
| 42 | 42 | $this->connection['pass'], |
@@ -101,21 +101,21 @@ discard block |
||
| 101 | 101 | ->addColumns( |
| 102 | 102 | $columns |
| 103 | 103 | ->clone() |
| 104 | - ->mapKey(function ($v) { return $v['Field']; }) |
|
| 104 | + ->mapKey(function($v) { return $v['Field']; }) |
|
| 105 | 105 | ->toArray() |
| 106 | 106 | ) |
| 107 | 107 | ->setPrimaryKey( |
| 108 | 108 | $columns |
| 109 | 109 | ->clone() |
| 110 | - ->filter(function ($v) { return $v['Key'] === 'PRI'; }) |
|
| 110 | + ->filter(function($v) { return $v['Key'] === 'PRI'; }) |
|
| 111 | 111 | ->pluck('Field') |
| 112 | 112 | ->toArray() |
| 113 | 113 | ) |
| 114 | 114 | ->setComment( |
| 115 | - (string)Collection::from($this |
|
| 115 | + (string) Collection::from($this |
|
| 116 | 116 | ->query( |
| 117 | 117 | "SELECT table_comment FROM information_schema.tables WHERE table_schema = ? AND table_name = ?", |
| 118 | - [ $this->connection['name'], $table ] |
|
| 118 | + [$this->connection['name'], $table] |
|
| 119 | 119 | )) |
| 120 | 120 | ->pluck('table_comment') |
| 121 | 121 | ->value() |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | "SELECT TABLE_NAME, COLUMN_NAME, CONSTRAINT_NAME, REFERENCED_COLUMN_NAME |
| 133 | 133 | FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE |
| 134 | 134 | WHERE TABLE_SCHEMA = ? AND REFERENCED_TABLE_SCHEMA = ? AND REFERENCED_TABLE_NAME = ?", |
| 135 | - [ $this->connection['name'], $this->connection['name'], $table ] |
|
| 135 | + [$this->connection['name'], $this->connection['name'], $table] |
|
| 136 | 136 | ) as $relation |
| 137 | 137 | ) { |
| 138 | 138 | $relations[$relation['CONSTRAINT_NAME']]['table'] = $relation['TABLE_NAME']; |
@@ -158,9 +158,9 @@ discard block |
||
| 158 | 158 | WHERE |
| 159 | 159 | TABLE_SCHEMA = ? AND TABLE_NAME = ? AND COLUMN_NAME IN (??) AND |
| 160 | 160 | REFERENCED_TABLE_NAME IS NOT NULL", |
| 161 | - [ $this->connection['name'], $data['table'], $columns ] |
|
| 161 | + [$this->connection['name'], $data['table'], $columns] |
|
| 162 | 162 | )) |
| 163 | - ->map(function ($v) { |
|
| 163 | + ->map(function($v) { |
|
| 164 | 164 | $new = []; |
| 165 | 165 | foreach ($v as $kk => $vv) { |
| 166 | 166 | $new[strtoupper($kk)] = $vv; |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | $relname = $foreign['table']; |
| 179 | 179 | $cntr = 1; |
| 180 | 180 | while ($definition->hasRelation($relname) || $definition->getName() == $relname) { |
| 181 | - $relname = $foreign['table'] . '_' . (++ $cntr); |
|
| 181 | + $relname = $foreign['table'].'_'.(++$cntr); |
|
| 182 | 182 | } |
| 183 | 183 | $definition->addRelation( |
| 184 | 184 | new TableRelation( |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | $relname = $data['table']; |
| 195 | 195 | $cntr = 1; |
| 196 | 196 | while ($definition->hasRelation($relname) || $definition->getName() == $relname) { |
| 197 | - $relname = $data['table'] . '_' . (++ $cntr); |
|
| 197 | + $relname = $data['table'].'_'.(++$cntr); |
|
| 198 | 198 | } |
| 199 | 199 | $definition->addRelation( |
| 200 | 200 | new TableRelation( |
@@ -215,9 +215,9 @@ discard block |
||
| 215 | 215 | "SELECT TABLE_NAME, COLUMN_NAME, CONSTRAINT_NAME, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME |
| 216 | 216 | FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE |
| 217 | 217 | WHERE TABLE_SCHEMA = ? AND TABLE_NAME = ? AND REFERENCED_TABLE_NAME IS NOT NULL", |
| 218 | - [ $this->connection['name'], $table ] |
|
| 218 | + [$this->connection['name'], $table] |
|
| 219 | 219 | )) |
| 220 | - ->map(function ($v) { |
|
| 220 | + ->map(function($v) { |
|
| 221 | 221 | $new = []; |
| 222 | 222 | foreach ($v as $kk => $vv) { |
| 223 | 223 | $new[strtoupper($kk)] = $vv; |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | $relname = $data['table']; |
| 233 | 233 | $cntr = 1; |
| 234 | 234 | while ($definition->hasRelation($relname) || $definition->getName() == $relname) { |
| 235 | - $relname = $data['table'] . '_' . (++ $cntr); |
|
| 235 | + $relname = $data['table'].'_'.(++$cntr); |
|
| 236 | 236 | } |
| 237 | 237 | $definition->addRelation( |
| 238 | 238 | new TableRelation( |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | "SELECT table_name FROM information_schema.tables where table_schema = ?", |
| 254 | 254 | [$this->connection['name']] |
| 255 | 255 | )) |
| 256 | - ->map(function ($v) { |
|
| 256 | + ->map(function($v) { |
|
| 257 | 257 | $new = []; |
| 258 | 258 | foreach ($v as $kk => $vv) { |
| 259 | 259 | $new[strtoupper($kk)] = $vv; |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | return $new; |
| 262 | 262 | }) |
| 263 | 263 | ->pluck('TABLE_NAME') |
| 264 | - ->map(function ($v) { |
|
| 264 | + ->map(function($v) { |
|
| 265 | 265 | return $this->table($v); |
| 266 | 266 | }) |
| 267 | 267 | ->toArray(); |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | } |
| 68 | 68 | public function next() |
| 69 | 69 | { |
| 70 | - $this->fetched ++; |
|
| 70 | + $this->fetched++; |
|
| 71 | 71 | $this->last = \ibase_fetch_assoc($this->result, \IBASE_TEXT); |
| 72 | 72 | } |
| 73 | 73 | public function valid() |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | $this->connect(); |
| 53 | 53 | $statement = \ibase_prepare($this->transaction !== null ? $this->transaction : $this->lnk, $sql); |
| 54 | 54 | if ($statement === false) { |
| 55 | - throw new DBException('Prepare error: ' . \ibase_errmsg()); |
|
| 55 | + throw new DBException('Prepare error: '.\ibase_errmsg()); |
|
| 56 | 56 | } |
| 57 | 57 | return new Statement( |
| 58 | 58 | $statement, |
@@ -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 | continue; |
| 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 | } |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | } |
| 56 | 56 | public function next() |
| 57 | 57 | { |
| 58 | - $this->fetched ++; |
|
| 58 | + $this->fetched++; |
|
| 59 | 59 | $this->last = $this->statement->fetch(\PDO::FETCH_ASSOC); |
| 60 | 60 | } |
| 61 | 61 | public function valid() |
@@ -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 | } |
@@ -62,11 +62,11 @@ discard block |
||
| 62 | 62 | $fields = []; |
| 63 | 63 | $exists = false; |
| 64 | 64 | foreach ($relation->table->getColumns() as $column) { |
| 65 | - $fields[$column] = $row[$name . '___' . $column]; |
|
| 66 | - if (!$exists && $row[$name . '___' . $column] !== null) { |
|
| 65 | + $fields[$column] = $row[$name.'___'.$column]; |
|
| 66 | + if (!$exists && $row[$name.'___'.$column] !== null) { |
|
| 67 | 67 | $exists = true; |
| 68 | 68 | } |
| 69 | - unset($result[$name . '___' . $column]); |
|
| 69 | + unset($result[$name.'___'.$column]); |
|
| 70 | 70 | } |
| 71 | 71 | if ($exists) { |
| 72 | 72 | if ($relation->many) { |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | return; |
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | - $this->fetched ++; |
|
| 116 | + $this->fetched++; |
|
| 117 | 117 | while ($this->result->valid()) { |
| 118 | 118 | $row = $this->result->current(); |
| 119 | 119 | $pk = []; |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | $instance->setDefault($data['default']); |
| 48 | 48 | } |
| 49 | 49 | if ($instance->getBasicType() === 'enum' && strpos($instance->getType(), 'enum(') === 0) { |
| 50 | - $temp = array_map(function ($v) { |
|
| 50 | + $temp = array_map(function($v) { |
|
| 51 | 51 | return str_replace("''", "'", $v); |
| 52 | 52 | }, explode("','", substr($instance->getType(), 6, -2))); |
| 53 | 53 | $instance->setValues($temp); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | public function setPrimaryKey($column) : Table |
| 79 | 79 | { |
| 80 | 80 | if (!is_array($column)) { |
| 81 | - $column = [ $column ]; |
|
| 81 | + $column = [$column]; |
|
| 82 | 82 | } |
| 83 | 83 | $this->data['primary'] = $column; |
| 84 | 84 | return $this; |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | if (!isset($name)) { |
| 168 | - $name = $toTable->getName() . '_' . implode('_', array_keys($keymap)); |
|
| 168 | + $name = $toTable->getName().'_'.implode('_', array_keys($keymap)); |
|
| 169 | 169 | } |
| 170 | 170 | $this->addRelation(new TableRelation( |
| 171 | 171 | $name, |