Completed
Push — master ( 3bf301...d91bdc )
by Ivan
17:12
created
src/driver/sphinx/Statement.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -40,23 +40,23 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/driver/odbc/Result.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/driver/postgre/Result.php 1 patch
Spacing   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,8 +36,7 @@  discard block
 block discarded – undo
36 36
             $temp = @\pg_query(
37 37
                 $this->driver,
38 38
                 $sequence ?
39
-                    'SELECT currval('.@\pg_escape_string($this->driver, $sequence).')' :
40
-                    'SELECT lastval()'
39
+                    'SELECT currval('.@\pg_escape_string($this->driver, $sequence).')' : 'SELECT lastval()'
41 40
             );
42 41
             if ($temp) {
43 42
                 $res = \pg_fetch_row($temp);
@@ -75,8 +74,8 @@  discard block
 block discarded – undo
75 74
     }
76 75
     public function next(): void
77 76
     {
78
-        $this->fetched ++;
79
-        $this->last = \pg_fetch_array($this->statement, null, \PGSQL_ASSOC)?:null;
77
+        $this->fetched++;
78
+        $this->last = \pg_fetch_array($this->statement, null, \PGSQL_ASSOC) ?: null;
80 79
     }
81 80
     public function valid(): bool
82 81
     {
Please login to merge, or discard this patch.
src/driver/postgre/Statement.php 1 patch
Spacing   +12 added lines, -14 removed lines patch added patch discarded remove patch
@@ -23,17 +23,17 @@  discard block
 block discarded – undo
23 23
         if (strpos(strtolower($statement), 'prepare') === 0) {
24 24
             $this->drv->raw($this->statement);
25 25
             if (!isset($this->name)) {
26
-                $this->name = trim((preg_split('(\s+)', trim($this->statement))?:[])[1]??'', '"');
26
+                $this->name = trim((preg_split('(\s+)', trim($this->statement)) ?: [])[1] ?? '', '"');
27 27
             }
28 28
         } elseif ($this->name !== null) {
29 29
             $temp = \pg_prepare($this->driver, $this->name, $this->statement);
30 30
             if (!$temp) {
31 31
                 $log = $this->drv->option('log_file');
32
-                if ($log && (int)$this->drv->option('log_errors', 1)) {
32
+                if ($log && (int) $this->drv->option('log_errors', 1)) {
33 33
                     @file_put_contents(
34 34
                         $log,
35
-                        '--' . date('Y-m-d H:i:s') . ' ERROR PREPARING: ' . \pg_last_error($this->driver) . "\r\n" .
36
-                        $this->statement . "\r\n" .
35
+                        '--'.date('Y-m-d H:i:s').' ERROR PREPARING: '.\pg_last_error($this->driver)."\r\n".
36
+                        $this->statement."\r\n".
37 37
                         "\r\n",
38 38
                         FILE_APPEND
39 39
                     );
@@ -59,19 +59,17 @@  discard block
 block discarded – undo
59 59
         }
60 60
         if ($this->name !== null) {
61 61
             $temp = (is_array($data) && count($data)) ?
62
-                \pg_execute($this->driver, $this->name, $data) :
63
-                \pg_execute($this->driver, $this->name, array());
62
+                \pg_execute($this->driver, $this->name, $data) : \pg_execute($this->driver, $this->name, array());
64 63
         } else {
65 64
             $temp = (is_array($data) && count($data)) ?
66
-                \pg_query_params($this->driver, $this->statement, $data) :
67
-                \pg_query_params($this->driver, $this->statement, array());
65
+                \pg_query_params($this->driver, $this->statement, $data) : \pg_query_params($this->driver, $this->statement, array());
68 66
         }
69 67
         if (!$temp) {
70
-            if ($log && (int)$this->drv->option('log_errors', 1)) {
68
+            if ($log && (int) $this->drv->option('log_errors', 1)) {
71 69
                 @file_put_contents(
72 70
                     $log,
73
-                    '--' . date('Y-m-d H:i:s') . ' ERROR: ' . \pg_last_error($this->driver) . "\r\n" .
74
-                    $this->statement . "\r\n" .
71
+                    '--'.date('Y-m-d H:i:s').' ERROR: '.\pg_last_error($this->driver)."\r\n".
72
+                    $this->statement."\r\n".
75 73
                     "\r\n",
76 74
                     FILE_APPEND
77 75
                 );
@@ -80,11 +78,11 @@  discard block
 block discarded – undo
80 78
         }
81 79
         if ($log) {
82 80
             $tm = microtime(true) - $tm;
83
-            if ($tm >= (float)$this->drv->option('log_slow', 0)) {
81
+            if ($tm >= (float) $this->drv->option('log_slow', 0)) {
84 82
                 @file_put_contents(
85 83
                     $log,
86
-                    '--' . date('Y-m-d H:i:s') . ' ' . sprintf('%01.6f', $tm) . "s\r\n" .
87
-                    $this->statement . "\r\n" .
84
+                    '--'.date('Y-m-d H:i:s').' '.sprintf('%01.6f', $tm)."s\r\n".
85
+                    $this->statement."\r\n".
88 86
                     "\r\n",
89 87
                     FILE_APPEND
90 88
                 );
Please login to merge, or discard this patch.
src/driver/sqlite/Result.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,8 +62,8 @@
 block discarded – undo
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
     {
Please login to merge, or discard this patch.
src/driver/ibase/Result.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,8 +67,8 @@
 block discarded – undo
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
     {
Please login to merge, or discard this patch.
src/schema/Mapper.php 1 patch
Spacing   +7 added lines, -8 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
     }
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
         $definition = $entity->definition();
137 137
         foreach ($definition->getColumns() as $column) {
138 138
             if (!array_key_exists($column, $data)) {
139
-                $entity->__lazyProperty($column, function () use ($definition, $primary, $column) {
139
+                $entity->__lazyProperty($column, function() use ($definition, $primary, $column) {
140 140
                     $query = $this->db->table($definition->getFullName());
141 141
                     foreach ($primary as $k => $v) {
142 142
                         $query->filter($k, $v);
@@ -150,18 +150,18 @@  discard block
 block discarded – undo
150 150
                 $name,
151 151
                 array_key_exists($name, $data) && isset($data[$name]) ?
152 152
                     ($relation->many ?
153
-                        array_map(function ($v) use ($relation) {
153
+                        array_map(function($v) use ($relation) {
154 154
                             return $this->entity($relation->table, $v);
155 155
                         }, $data[$name]) :
156 156
                         $this->entity($relation->table, $data[$name])
157 157
                     ) :
158
-                    function (array $columns = null, string $order = null, bool $desc = false) use ($entity, $definition, $relation, $data) {
158
+                    function(array $columns = null, string $order = null, bool $desc = false) use ($entity, $definition, $relation, $data) {
159 159
                         $query = $this->db->table($relation->table->getFullName(), true);
160 160
                         if ($columns !== null) {
161 161
                             $query->columns($columns);
162 162
                         }
163 163
                         if ($relation->sql) {
164
-                            $query->where($relation->sql, $relation->par?:[]);
164
+                            $query->where($relation->sql, $relation->par ?: []);
165 165
                         }
166 166
                         if ($relation->pivot) {
167 167
                             $nm = null;
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
                                 );
182 182
                             }
183 183
                             foreach ($definition->getPrimaryKey() as $v) {
184
-                                $query->filter($nm . '.' . $v, $data[$v] ?? null);
184
+                                $query->filter($nm.'.'.$v, $data[$v] ?? null);
185 185
                             }
186 186
                         } else {
187 187
                             foreach ($relation->keymap as $k => $v) {
@@ -192,8 +192,7 @@  discard block
 block discarded – undo
192 192
                             $query->sort($order, $desc);
193 193
                         }
194 194
                         return $relation->many ?
195
-                            $query->iterator() :
196
-                            $query[0];
195
+                            $query->iterator() : $query[0];
197 196
                     }
198 197
             );
199 198
         }
Please login to merge, or discard this patch.
src/schema/Table.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -79,10 +79,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 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,
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/schema/TableColumn.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
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);
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     }
170 170
     public function getLength(): int
171 171
     {
172
-        return (int)$this->length;
172
+        return (int) $this->length;
173 173
     }
174 174
     public function setLength(int $length): static
175 175
     {
Please login to merge, or discard this patch.