@@ -57,8 +57,8 @@ |
||
| 57 | 57 | } |
| 58 | 58 | public function next(): void |
| 59 | 59 | { |
| 60 | - $this->fetched ++; |
|
| 61 | - $this->last = $this->result->fetch_assoc()?:null; |
|
| 60 | + $this->fetched++; |
|
| 61 | + $this->last = $this->result->fetch_assoc() ?: null; |
|
| 62 | 62 | } |
| 63 | 63 | public function valid(): bool |
| 64 | 64 | { |
@@ -40,23 +40,23 @@ |
||
| 40 | 40 | break; |
| 41 | 41 | case 'array': |
| 42 | 42 | $par = implode(',', $par); |
| 43 | - $par = "'" . $this->lnk->escape_string($par) . "'"; |
|
| 43 | + $par = "'".$this->lnk->escape_string($par)."'"; |
|
| 44 | 44 | break; |
| 45 | 45 | case 'object': |
| 46 | 46 | $par = serialize($par); |
| 47 | - $par = "'" . $this->lnk->escape_string($par) . "'"; |
|
| 47 | + $par = "'".$this->lnk->escape_string($par)."'"; |
|
| 48 | 48 | break; |
| 49 | 49 | case 'resource': |
| 50 | 50 | if (is_resource($par) && get_resource_type($par) === 'stream') { |
| 51 | 51 | $par = stream_get_contents($par); |
| 52 | - $par = "'" . $this->lnk->escape_string($par) . "'"; |
|
| 52 | + $par = "'".$this->lnk->escape_string($par)."'"; |
|
| 53 | 53 | } else { |
| 54 | 54 | $par = serialize($par); |
| 55 | - $par = "'" . $this->lnk->escape_string($par) . "'"; |
|
| 55 | + $par = "'".$this->lnk->escape_string($par)."'"; |
|
| 56 | 56 | } |
| 57 | 57 | break; |
| 58 | 58 | default: |
| 59 | - $par = "'" . $this->lnk->escape_string((string)$par) . "'"; |
|
| 59 | + $par = "'".$this->lnk->escape_string((string) $par)."'"; |
|
| 60 | 60 | break; |
| 61 | 61 | } |
| 62 | 62 | $sql .= $par; |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | } |
| 79 | 79 | public function next(): void |
| 80 | 80 | { |
| 81 | - $this->fetched ++; |
|
| 81 | + $this->fetched++; |
|
| 82 | 82 | $temp = \odbc_fetch_row($this->statement); |
| 83 | 83 | if (!$temp) { |
| 84 | 84 | $this->last = null; |
@@ -62,8 +62,8 @@ |
||
| 62 | 62 | } |
| 63 | 63 | public function next(): void |
| 64 | 64 | { |
| 65 | - $this->fetched ++; |
|
| 66 | - $this->last = $this->statement->fetchArray(\SQLITE3_ASSOC)?:null; |
|
| 65 | + $this->fetched++; |
|
| 66 | + $this->last = $this->statement->fetchArray(\SQLITE3_ASSOC) ?: null; |
|
| 67 | 67 | } |
| 68 | 68 | public function valid(): bool |
| 69 | 69 | { |
@@ -67,8 +67,8 @@ |
||
| 67 | 67 | } |
| 68 | 68 | public function next(): void |
| 69 | 69 | { |
| 70 | - $this->fetched ++; |
|
| 71 | - $this->last = \ibase_fetch_assoc($this->result, \IBASE_TEXT)?:null; |
|
| 70 | + $this->fetched++; |
|
| 71 | + $this->last = \ibase_fetch_assoc($this->result, \IBASE_TEXT) ?: null; |
|
| 72 | 72 | } |
| 73 | 73 | public function valid(): bool |
| 74 | 74 | { |
@@ -79,10 +79,10 @@ discard block |
||
| 79 | 79 | * @param array|string $column either a single column name or an array of column names |
| 80 | 80 | * @return static |
| 81 | 81 | */ |
| 82 | - public function setPrimaryKey(array|string $column): static |
|
| 82 | + public function setPrimaryKey(array | string $column): static |
|
| 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 |
||
| 109 | 109 | */ |
| 110 | 110 | public function getFullName(): string |
| 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 |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | public function hasOne( |
| 157 | 157 | Table $toTable, |
| 158 | 158 | string $name = null, |
| 159 | - string|array|null $toTableColumn = null, |
|
| 159 | + string | array | null $toTableColumn = null, |
|
| 160 | 160 | string $sql = null, |
| 161 | 161 | array $par = [] |
| 162 | 162 | ) : static { |
@@ -184,7 +184,7 @@ discard block |
||
| 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, |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | public function hasMany( |
| 211 | 211 | Table $toTable, |
| 212 | 212 | string $name = null, |
| 213 | - string|array|null $toTableColumn = null, |
|
| 213 | + string | array | null $toTableColumn = null, |
|
| 214 | 214 | ?string $sql = null, |
| 215 | 215 | array $par = [] |
| 216 | 216 | ): static { |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | public function belongsTo( |
| 265 | 265 | Table $toTable, |
| 266 | 266 | string $name = null, |
| 267 | - string|array|null $localColumn = null, |
|
| 267 | + string | array | null $localColumn = null, |
|
| 268 | 268 | ?string $sql = null, |
| 269 | 269 | array $par = [] |
| 270 | 270 | ): static { |
@@ -319,8 +319,8 @@ discard block |
||
| 319 | 319 | Table $toTable, |
| 320 | 320 | Table $pivot, |
| 321 | 321 | ?string $name = null, |
| 322 | - string|array|null $toTableColumn = null, |
|
| 323 | - string|array|null $localColumn = null |
|
| 322 | + string | array | null $toTableColumn = null, |
|
| 323 | + string | array | null $localColumn = null |
|
| 324 | 324 | ): static { |
| 325 | 325 | $pivotColumns = $pivot->getColumns(); |
| 326 | 326 | |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | protected static array $mappers = []; |
| 15 | 15 | protected MapperInterface $mapper; |
| 16 | 16 | |
| 17 | - public function __construct(DBInterface $db, Table|string $table, bool $findRelations = false) |
|
| 17 | + public function __construct(DBInterface $db, Table | string $table, bool $findRelations = false) |
|
| 18 | 18 | { |
| 19 | 19 | parent::__construct($db, $table, $findRelations); |
| 20 | 20 | if (!isset(static::$mappers[spl_object_hash($db)])) { |
@@ -71,7 +71,7 @@ |
||
| 71 | 71 | $this->softDetect($sql); |
| 72 | 72 | $statement = \ibase_prepare($this->transaction !== null ? $this->transaction : $this->lnk, $sql); |
| 73 | 73 | if ($statement === false) { |
| 74 | - throw new DBException('Prepare error: ' . \ibase_errmsg()); |
|
| 74 | + throw new DBException('Prepare error: '.\ibase_errmsg()); |
|
| 75 | 75 | } |
| 76 | 76 | return new Statement( |
| 77 | 77 | $statement, |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $this->query("ALTER SESSION SET time_zone = '".addslashes($timezone)."'"); |
| 45 | 45 | } |
| 46 | 46 | if ($schema = $this->option('schema')) { |
| 47 | - $this->query("ALTER SESSION SET CURRENT_SCHEMA = " . $schema); |
|
| 47 | + $this->query("ALTER SESSION SET CURRENT_SCHEMA = ".$schema); |
|
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | } |
@@ -81,11 +81,11 @@ discard block |
||
| 81 | 81 | ); |
| 82 | 82 | if ($log) { |
| 83 | 83 | $tm = microtime(true) - $tm; |
| 84 | - if ($tm >= (float)$this->option('log_slow', 0)) { |
|
| 84 | + if ($tm >= (float) $this->option('log_slow', 0)) { |
|
| 85 | 85 | @file_put_contents( |
| 86 | 86 | $log, |
| 87 | - '--' . date('Y-m-d H:i:s') . ' ' . sprintf('%01.6f', $tm) . "s\r\n" . |
|
| 88 | - $sql . "\r\n" . |
|
| 87 | + '--'.date('Y-m-d H:i:s').' '.sprintf('%01.6f', $tm)."s\r\n". |
|
| 88 | + $sql."\r\n". |
|
| 89 | 89 | "\r\n", |
| 90 | 90 | FILE_APPEND |
| 91 | 91 | ); |