@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | $table, |
| 29 | 29 | $columns, |
| 30 | 30 | $rowsets |
| 31 | - ) . (!empty($primaryKey) ? ' RETURNING ' . $this->quote($primaryKey) : ''); |
|
| 31 | + ).(!empty($primaryKey) ? ' RETURNING '.$this->quote($primaryKey) : ''); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -40,6 +40,6 @@ discard block |
||
| 40 | 40 | return ''; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - return 'DISTINCT' . (is_string($distinct) ? '(' . $this->quote($distinct) . ')' : ''); |
|
| 43 | + return 'DISTINCT'.(is_string($distinct) ? '('.$this->quote($distinct).')' : ''); |
|
| 44 | 44 | } |
| 45 | 45 | } |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | //Resolve table primary key if any |
| 38 | - $primary = $driver->getPrimary($this->database->getPrefix() . $this->table); |
|
| 38 | + $primary = $driver->getPrimary($this->database->getPrefix().$this->table); |
|
| 39 | 39 | |
| 40 | 40 | if (empty($compiler)) { |
| 41 | 41 | $compiler = $this->compiler->resetQuoter(); |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | protected function expression(string $identifier): string |
| 96 | 96 | { |
| 97 | - return preg_replace_callback('/([a-z][0-9_a-z\.]*\(?)/i', function ($match) { |
|
| 97 | + return preg_replace_callback('/([a-z][0-9_a-z\.]*\(?)/i', function($match) { |
|
| 98 | 98 | $identifier = $match[1]; |
| 99 | 99 | |
| 100 | 100 | //Function name |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | protected function aliasing(string $identifier, string $alias, bool $isTable): string |
| 119 | 119 | { |
| 120 | - $quoted = $this->quote($identifier, $isTable) . ' AS ' . $this->driver->identifier($alias); |
|
| 120 | + $quoted = $this->quote($identifier, $isTable).' AS '.$this->driver->identifier($alias); |
|
| 121 | 121 | |
| 122 | 122 | if ($isTable && strpos($identifier, '.') === false) { |
| 123 | 123 | //We have to apply operation post factum to prevent self aliasing (name AS name) |
@@ -154,12 +154,12 @@ discard block |
||
| 154 | 154 | protected function unpaired(string $identifier, bool $isTable): string |
| 155 | 155 | { |
| 156 | 156 | if ($isTable && !isset($this->aliases[$identifier])) { |
| 157 | - if (!isset($this->aliases[$this->prefix . $identifier])) { |
|
| 157 | + if (!isset($this->aliases[$this->prefix.$identifier])) { |
|
| 158 | 158 | //Generating our alias |
| 159 | - $this->aliases[$this->prefix . $identifier] = $identifier; |
|
| 159 | + $this->aliases[$this->prefix.$identifier] = $identifier; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - $identifier = $this->prefix . $identifier; |
|
| 162 | + $identifier = $this->prefix.$identifier; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | return $this->driver->identifier($identifier); |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | * @param array|\Closure $where Selection WHERE statement. |
| 43 | 43 | * @param array $load Array or relations to be pre-loaded. |
| 44 | 44 | * @param array $orderBy Sort by conditions. |
| 45 | - * @return RecordEntity|null |
|
| 45 | + * @return null|\Spiral\ORM\RecordInterface |
|
| 46 | 46 | */ |
| 47 | 47 | public static function findOne($where = [], array $load = [], array $orderBy = []) |
| 48 | 48 | { |
@@ -228,7 +228,7 @@ |
||
| 228 | 228 | * Execute statement. |
| 229 | 229 | * |
| 230 | 230 | * @param string $statement |
| 231 | - * @param array $parameters |
|
| 231 | + * @param string[] $parameters |
|
| 232 | 232 | * @return \PDOStatement |
| 233 | 233 | */ |
| 234 | 234 | protected function run($statement, array $parameters = []) |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | if (!empty($table->getPrimaryKeys())) { |
| 286 | 286 | $primaryKeys = array_map([$this, 'quote'], $table->getPrimaryKeys()); |
| 287 | 287 | |
| 288 | - $innerStatement[] = 'PRIMARY KEY (' . implode(', ', $primaryKeys) . ')'; |
|
| 288 | + $innerStatement[] = 'PRIMARY KEY ('.implode(', ', $primaryKeys).')'; |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | //Constraints and foreign keys |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | $innerStatement[] = $reference->sqlStatement(); |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | - $statement[] = ' ' . implode(",\n ", $innerStatement); |
|
| 296 | + $statement[] = ' '.implode(",\n ", $innerStatement); |
|
| 297 | 297 | $statement[] = ')'; |
| 298 | 298 | |
| 299 | 299 | return implode("\n", $statement); |
@@ -162,7 +162,7 @@ |
||
| 162 | 162 | protected function generateName() |
| 163 | 163 | { |
| 164 | 164 | //We can generate name |
| 165 | - $name = $this->table->getName() . '_index_' . implode('_', $this->columns) . '_' . uniqid(); |
|
| 165 | + $name = $this->table->getName().'_index_'.implode('_', $this->columns).'_'.uniqid(); |
|
| 166 | 166 | |
| 167 | 167 | if (strlen($name) > 64) { |
| 168 | 168 | //Many dbs has limitations on identifier length |
@@ -748,7 +748,7 @@ |
||
| 748 | 748 | } |
| 749 | 749 | |
| 750 | 750 | if (!empty($enumValues)) { |
| 751 | - return '(' . implode(', ', $enumValues) . ')'; |
|
| 751 | + return '('.implode(', ', $enumValues).')'; |
|
| 752 | 752 | } |
| 753 | 753 | |
| 754 | 754 | return ''; |
@@ -164,7 +164,7 @@ |
||
| 164 | 164 | */ |
| 165 | 165 | public function setName($name) |
| 166 | 166 | { |
| 167 | - parent::setName($this->prefix . $name); |
|
| 167 | + parent::setName($this->prefix.$name); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | public function references(string $table, string $column = 'id'): AbstractReference |
| 168 | 168 | { |
| 169 | - $this->foreignTable = $this->table->getPrefix() . $table; |
|
| 169 | + $this->foreignTable = $this->table->getPrefix().$table; |
|
| 170 | 170 | $this->foreignKey = $column; |
| 171 | 171 | |
| 172 | 172 | return $this; |
@@ -212,10 +212,10 @@ discard block |
||
| 212 | 212 | $statement[] = 'CONSTRAINT'; |
| 213 | 213 | $statement[] = $this->getName(true); |
| 214 | 214 | $statement[] = 'FOREIGN KEY'; |
| 215 | - $statement[] = '(' . $this->table->getDriver()->identifier($this->column) . ')'; |
|
| 215 | + $statement[] = '('.$this->table->getDriver()->identifier($this->column).')'; |
|
| 216 | 216 | |
| 217 | - $statement[] = 'REFERENCES ' . $this->table->getDriver()->identifier($this->foreignTable); |
|
| 218 | - $statement[] = '(' . $this->table->getDriver()->identifier($this->foreignKey) . ')'; |
|
| 217 | + $statement[] = 'REFERENCES '.$this->table->getDriver()->identifier($this->foreignTable); |
|
| 218 | + $statement[] = '('.$this->table->getDriver()->identifier($this->foreignKey).')'; |
|
| 219 | 219 | |
| 220 | 220 | $statement[] = "ON DELETE {$this->deleteRule}"; |
| 221 | 221 | $statement[] = "ON UPDATE {$this->updateRule}"; |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | */ |
| 246 | 246 | protected function generateName(): string |
| 247 | 247 | { |
| 248 | - $name = $this->table->getName() . '_foreign_' . $this->column . '_' . uniqid(); |
|
| 248 | + $name = $this->table->getName().'_foreign_'.$this->column.'_'.uniqid(); |
|
| 249 | 249 | |
| 250 | 250 | if (strlen($name) > 64) { |
| 251 | 251 | //Many dbs has limitations on identifier length |