Completed
Push — master ( 9d47fe...c150be )
by Edgard
27:49
created
src/DataReader.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
     /**
33 33
      * Returns a single column from the next row of a result set.
34 34
      * @param integer $columnIndex zero-based column index
35
-     * @return mixed the column of the current row, false if no more rows available
35
+     * @return string|false the column of the current row, false if no more rows available
36 36
      */
37 37
     public function readColumn($columnIndex)
38 38
     {
Please login to merge, or discard this patch.
src/QueryBuilder.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -146,7 +146,7 @@
 block discarded – undo
146 146
             $orderByStatment = $this->buildOrderBy($newOrderBy);
147 147
 
148 148
             $sql = str_replace(':order', $orderByStatment,$sql);
149
-        }else{
149
+        } else{
150 150
             $orderByStatment = $this->buildOrderBy($orderBy);
151 151
             if ($orderByStatment !== '') {
152 152
                 $sql .= $this->separator . $orderByStatment;
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
     {
69 69
         $table = $this->db->getTableSchema($tableName);
70 70
 
71
-        if ($table !== null && isset($table->columns[$table->sequenceName])) {
71
+        if ($table !== null && isset($table->columns[ $table->sequenceName ])) {
72 72
             if ($value === null) {
73
-                $sql = 'SELECT MAX("'. $table->sequenceName .'") FROM "'. $tableName . '"';
73
+                $sql = 'SELECT MAX("' . $table->sequenceName . '") FROM "' . $tableName . '"';
74 74
                 $value = $this->db->createCommand($sql)->queryScalar() + 1;
75 75
             } else {
76 76
                 $value = (int) $value;
77 77
             }
78
-            return 'ALTER TABLE "' . $tableName . '" ALTER COLUMN "'.$table->sequenceName.'" RESTART WITH ' . $value;
78
+            return 'ALTER TABLE "' . $tableName . '" ALTER COLUMN "' . $table->sequenceName . '" RESTART WITH ' . $value;
79 79
         } elseif ($table === null) {
80 80
             throw new InvalidParamException("Table not found: $tableName");
81 81
         } else {
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     public function checkIntegrity($check = true, $schema = '', $table = '')
96 96
     {
97 97
         if ($table) {
98
-            $tableNames = [$table];
98
+            $tableNames = [ $table ];
99 99
         } else {
100 100
             if (!$schema) {
101 101
                 $schema = $this->db->defaultSchema;
@@ -128,13 +128,13 @@  discard block
 block discarded – undo
128 128
             return '';
129 129
         }
130 130
 
131
-        $quotedTableNames = [];
131
+        $quotedTableNames = [ ];
132 132
         foreach ($tableNames as $tableName) {
133
-            $quotedTableNames[] = $this->db->quoteTableName($tableName) . ($check? '' : ' ALL');
133
+            $quotedTableNames[ ] = $this->db->quoteTableName($tableName) . ($check ? '' : ' ALL');
134 134
         }
135 135
 
136 136
         $enable = $check ? 'CHECKED' : 'UNCHECKED';
137
-        return 'SET INTEGRITY FOR ' . implode(', ', $quotedTableNames) . ' IMMEDIATE ' . $enable. ';';
137
+        return 'SET INTEGRITY FOR ' . implode(', ', $quotedTableNames) . ' IMMEDIATE ' . $enable . ';';
138 138
     }
139 139
 
140 140
     /**
@@ -147,22 +147,22 @@  discard block
 block discarded – undo
147 147
             $sql = str_replace(':query', $sql, $limitOffsetStatment);
148 148
 
149 149
             //convert "item"."id" to "id" to use in OVER()
150
-            $newOrderBy = [];
150
+            $newOrderBy = [ ];
151 151
 
152
-            if(!empty($orderBy)){
152
+            if (!empty($orderBy)) {
153 153
                 foreach ($orderBy as $name => $direction) {
154
-                    if(is_string($name)){
154
+                    if (is_string($name)) {
155 155
                         $e = explode('.', $name);
156 156
                         $name = array_pop($e);
157 157
                     }
158
-                    $newOrderBy[$name] = $direction;
158
+                    $newOrderBy[ $name ] = $direction;
159 159
                 }
160 160
             }
161 161
 
162 162
             $orderByStatment = $this->buildOrderBy($newOrderBy);
163 163
 
164
-            $sql = str_replace(':order', $orderByStatment,$sql);
165
-        }else{
164
+            $sql = str_replace(':order', $orderByStatment, $sql);
165
+        } else {
166 166
             $orderByStatment = $this->buildOrderBy($orderBy);
167 167
             if ($orderByStatment !== '') {
168 168
                 $sql .= $this->separator . $orderByStatment;
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
         
197 197
         if ($this->hasLimit($limit)) {
198 198
             if ($limit instanceof \yii\db\ExpressionInterface || $offset instanceof \yii\db\ExpressionInterface) {
199
-                $replacement = 'AND t.RN_ <= (' . $limit  . ' + ' . $offset . ')';
199
+                $replacement = 'AND t.RN_ <= (' . $limit . ' + ' . $offset . ')';
200 200
             } else {
201 201
                 $replacement = 'AND t.RN_ <= ' . ($limit + $offset);
202 202
             }
@@ -219,19 +219,19 @@  discard block
 block discarded – undo
219 219
     /**
220 220
      * @inheritdoc
221 221
      */
222
-    public function prepareInsertValues($table, $columns, $params = [])
222
+    public function prepareInsertValues($table, $columns, $params = [ ])
223 223
     {
224 224
         $result = parent::prepareInsertValues($table, $columns, $params);
225 225
 
226 226
         // Empty placeholders, replace for (DEFAULT, DEFAULT, ...)
227
-        if (empty($result[1]) && $result[2] === ' DEFAULT VALUES') {
227
+        if (empty($result[ 1 ]) && $result[ 2 ] === ' DEFAULT VALUES') {
228 228
             $schema = $this->db->getSchema();
229 229
             if (($tableSchema = $schema->getTableSchema($table)) !== null) {
230 230
                 $columnSchemas = $tableSchema->columns;
231 231
             } else {
232
-                $columnSchemas = [];
232
+                $columnSchemas = [ ];
233 233
             }
234
-            $result[1] = array_fill(0, count($columnSchemas), 'DEFAULT');
234
+            $result[ 1 ] = array_fill(0, count($columnSchemas), 'DEFAULT');
235 235
         }
236 236
 
237 237
         return $result;
@@ -248,22 +248,22 @@  discard block
 block discarded – undo
248 248
             return $this->insert($table, $insertColumns, $params);
249 249
         }
250 250
 
251
-        $onCondition = ['or'];
251
+        $onCondition = [ 'or' ];
252 252
         $quotedTableName = $this->db->quoteTableName($table);
253 253
         foreach ($constraints as $constraint) {
254
-            $constraintCondition = ['and'];
254
+            $constraintCondition = [ 'and' ];
255 255
             foreach ($constraint->columnNames as $name) {
256 256
                 $quotedName = $this->db->quoteColumnName($name);
257
-                $constraintCondition[] = "$quotedTableName.$quotedName=\"EXCLUDED\".$quotedName";
257
+                $constraintCondition[ ] = "$quotedTableName.$quotedName=\"EXCLUDED\".$quotedName";
258 258
             }
259
-            $onCondition[] = $constraintCondition;
259
+            $onCondition[ ] = $constraintCondition;
260 260
         }
261 261
         $on = $this->buildCondition($onCondition, $params);
262 262
         list(, $placeholders, $values, $params) = $this->prepareInsertValues($table, $insertColumns, $params);
263 263
         if (!empty($placeholders)) {
264
-            $usingSelectValues = [];
264
+            $usingSelectValues = [ ];
265 265
             foreach ($insertNames as $index => $name) {
266
-                $usingSelectValues[$name] = new Expression($placeholders[$index]);
266
+                $usingSelectValues[ $name ] = new Expression($placeholders[ $index ]);
267 267
             }
268 268
             $usingSubQuery = (new Query())
269 269
                 ->select($usingSelectValues)
@@ -273,13 +273,13 @@  discard block
 block discarded – undo
273 273
         $mergeSql = 'MERGE INTO ' . $this->db->quoteTableName($table) . ' '
274 274
             . 'USING (' . (isset($usingValues) ? $usingValues : ltrim($values, ' ')) . ') "EXCLUDED" '
275 275
             . "ON ($on)";
276
-        $insertValues = [];
276
+        $insertValues = [ ];
277 277
         foreach ($insertNames as $name) {
278 278
             $quotedName = $this->db->quoteColumnName($name);
279 279
             if (strrpos($quotedName, '.') === false) {
280 280
                 $quotedName = '"EXCLUDED".' . $quotedName;
281 281
             }
282
-            $insertValues[] = $quotedName;
282
+            $insertValues[ ] = $quotedName;
283 283
         }
284 284
         $insertSql = 'INSERT (' . implode(', ', $insertNames) . ')'
285 285
             . ' VALUES (' . implode(', ', $insertValues) . ')';
@@ -288,13 +288,13 @@  discard block
 block discarded – undo
288 288
         }
289 289
 
290 290
         if ($updateColumns === true) {
291
-            $updateColumns = [];
291
+            $updateColumns = [ ];
292 292
             foreach ($updateNames as $name) {
293 293
                 $quotedName = $this->db->quoteColumnName($name);
294 294
                 if (strrpos($quotedName, '.') === false) {
295 295
                     $quotedName = '"EXCLUDED".' . $quotedName;
296 296
                 }
297
-                $updateColumns[$name] = new Expression($quotedName);
297
+                $updateColumns[ $name ] = new Expression($quotedName);
298 298
             }
299 299
         }
300 300
         list($updates, $params) = $this->prepareUpdateSets($table, $updateColumns, $params);
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
      */
312 312
     public function selectExists($rawSql)
313 313
     {
314
-        return 'SELECT CASE WHEN COUNT(*)>0 THEN 1 ELSE 0 END FROM (' . $rawSql . ') CHECKEXISTS';;
314
+        return 'SELECT CASE WHEN COUNT(*)>0 THEN 1 ELSE 0 END FROM (' . $rawSql . ') CHECKEXISTS'; ;
315 315
     }
316 316
 
317 317
     /**
Please login to merge, or discard this patch.
src/Schema.php 4 patches
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
             $command->bindValue(':schema', $this->db->defaultSchema);
279 279
             $command->bindValue(':table1', $table->name);
280 280
 
281
-        }else {
281
+        } else {
282 282
             if (isset($table->schemaName)) {
283 283
                 $command->bindValue(':schema', $table->schemaName);
284 284
             }
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
         $command->bindValue(':table', $table->name);
354 354
         if($this->db->isISeries){
355 355
             $command->bindValue(':schema', $this->db->defaultSchema);
356
-        }else {
356
+        } else {
357 357
             if (isset($table->schemaName)) {
358 358
                 $command->bindValue(':schema', $table->schemaName);
359 359
             }
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
                   AND qsys2.syscst.table_schema = :schema
401 401
                   ORDER BY qsys2.syskeycst.column_position
402 402
 SQL;
403
-        }else {
403
+        } else {
404 404
             $sql = <<<SQL
405 405
             SELECT
406 406
                 i.indname AS indexname,
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 
425 425
         if($this->db->isISeries){
426 426
             $command->bindValue(':schema', $this->db->defaultSchema);
427
-        }else{
427
+        } else{
428 428
             if (isset($table->schemaName)) {
429 429
                 $command->bindValue(':schema', $table->schemaName);
430 430
             }
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
                   AND TABLE_SCHEMA = :schema
460 460
                 ORDER BY TABLE_NAME
461 461
 SQL;
462
-        }else {
462
+        } else {
463 463
 
464 464
             $sql = <<<SQL
465 465
             SELECT
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
         'timestmp'   => self::TYPE_TIMESTAMP
55 55
     ];
56 56
 
57
-   /**
57
+    /**
58 58
      * @inheritdoc
59 59
      */
60 60
     public function createQueryBuilder()
Please login to merge, or discard this patch.
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -98,6 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
     /**
100 100
      * @inheritdoc
101
+     * @param TableSchema $table
101 102
      */
102 103
     protected function resolveTableNames($table, $name)
103 104
     {
@@ -182,6 +183,7 @@  discard block
 block discarded – undo
182 183
 
183 184
     /**
184 185
      * @inheritdoc
186
+     * @param TableSchema $table
185 187
      */
186 188
     protected function findColumns($table)
187 189
     {
@@ -271,6 +273,7 @@  discard block
 block discarded – undo
271 273
 
272 274
     /**
273 275
      * @inheritdoc
276
+     * @param TableSchema $table
274 277
      */
275 278
     protected function findConstraints($table)
276 279
     {
@@ -862,6 +865,9 @@  discard block
 block discarded – undo
862 865
         return $result;
863 866
     }
864 867
 
868
+    /**
869
+     * @param boolean $multiple
870
+     */
865 871
     protected function normalizePdoRowKeyCase(array $row, $multiple)
866 872
     {
867 873
         if ($this->db->getSlavePdo()->getAttribute(\PDO::ATTR_CASE) === \PDO::CASE_LOWER) {
Please login to merge, or discard this patch.
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -102,12 +102,12 @@  discard block
 block discarded – undo
102 102
     protected function resolveTableNames($table, $name)
103 103
     {
104 104
         $parts = explode('.', str_replace('"', '', $name));
105
-        if (isset($parts[1])) {
106
-            $table->schemaName = $parts[0];
107
-            $table->name = $parts[1];
105
+        if (isset($parts[ 1 ])) {
106
+            $table->schemaName = $parts[ 0 ];
107
+            $table->name = $parts[ 1 ];
108 108
             $table->fullName = $table->schemaName . '.' . $table->name;
109 109
         } else {
110
-            $table->fullName = $table->name = $parts[0];
110
+            $table->fullName = $table->name = $parts[ 0 ];
111 111
         }
112 112
     }
113 113
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
         ];
140 140
         $type = gettype($data);
141 141
 
142
-        return isset($typeMap[$type]) ? $typeMap[$type] : PDO::PARAM_STR;
142
+        return isset($typeMap[ $type ]) ? $typeMap[ $type ] : PDO::PARAM_STR;
143 143
     }
144 144
 
145 145
     /**
@@ -149,24 +149,24 @@  discard block
 block discarded – undo
149 149
     {
150 150
         $column = $this->createColumnSchema();
151 151
 
152
-        $column->name = $info['name'];
153
-        $column->dbType = $info['dbtype'];
154
-        $column->defaultValue = isset($info['defaultvalue']) ? trim($info['defaultvalue'], "''") : null;
155
-        $column->scale = (int) $info['scale'];
156
-        $column->size = (int) $info['size'];
157
-        $column->precision = (int) $info['size'];
158
-        $column->allowNull = $info['allownull'] === '1';
159
-        $column->isPrimaryKey = $info['isprimarykey'] === '1';
160
-        $column->autoIncrement = $info['autoincrement'] === '1';
152
+        $column->name = $info[ 'name' ];
153
+        $column->dbType = $info[ 'dbtype' ];
154
+        $column->defaultValue = isset($info[ 'defaultvalue' ]) ? trim($info[ 'defaultvalue' ], "''") : null;
155
+        $column->scale = (int) $info[ 'scale' ];
156
+        $column->size = (int) $info[ 'size' ];
157
+        $column->precision = (int) $info[ 'size' ];
158
+        $column->allowNull = $info[ 'allownull' ] === '1';
159
+        $column->isPrimaryKey = $info[ 'isprimarykey' ] === '1';
160
+        $column->autoIncrement = $info[ 'autoincrement' ] === '1';
161 161
         $column->unsigned = false;
162
-        $column->type = $this->typeMap[strtolower($info['dbtype'])];
162
+        $column->type = $this->typeMap[ strtolower($info[ 'dbtype' ]) ];
163 163
         $column->enumValues = null;
164
-        $column->comment = isset($info['comment']) ? $info['comment'] : null;
164
+        $column->comment = isset($info[ 'comment' ]) ? $info[ 'comment' ] : null;
165 165
 
166
-        if (preg_match('/(varchar|character|clob|graphic|binary|blob)/i', $info['dbtype'])) {
167
-            $column->dbType .= '(' . $info['size'] . ')';
168
-        } elseif (preg_match('/(decimal|double|real)/i', $info['dbtype'])) {
169
-            $column->dbType .= '(' . $info['size'] . ',' . $info['scale'] . ')';
166
+        if (preg_match('/(varchar|character|clob|graphic|binary|blob)/i', $info[ 'dbtype' ])) {
167
+            $column->dbType .= '(' . $info[ 'size' ] . ')';
168
+        } elseif (preg_match('/(decimal|double|real)/i', $info[ 'dbtype' ])) {
169
+            $column->dbType .= '(' . $info[ 'size' ] . ',' . $info[ 'scale' ] . ')';
170 170
         }
171 171
 
172 172
         if ($column->defaultValue) {
@@ -240,11 +240,11 @@  discard block
 block discarded – undo
240 240
 
241 241
         $command = $this->db->createCommand($sql);
242 242
         $command->bindValue(':table', $table->name);
243
-        if($this->db->isISeries){
243
+        if ($this->db->isISeries) {
244 244
             $command->bindValue(':schema', $this->db->defaultSchema);
245 245
             $command->bindValue(':table1', $table->name);
246 246
 
247
-        }else {
247
+        } else {
248 248
             if (isset($table->schemaName)) {
249 249
                 $command->bindValue(':schema', $table->schemaName);
250 250
             }
@@ -258,9 +258,9 @@  discard block
 block discarded – undo
258 258
 
259 259
         foreach ($columns as $info) {
260 260
             $column = $this->loadColumnSchema($info);
261
-            $table->columns[$column->name] = $column;
261
+            $table->columns[ $column->name ] = $column;
262 262
             if ($column->isPrimaryKey) {
263
-                $table->primaryKey[] = $column->name;
263
+                $table->primaryKey[ ] = $column->name;
264 264
                 if ($column->autoIncrement) {
265 265
                     $table->sequenceName = $column->name;
266 266
                 }
@@ -318,9 +318,9 @@  discard block
 block discarded – undo
318 318
         }
319 319
         $command = $this->db->createCommand($sql);
320 320
         $command->bindValue(':table', $table->name);
321
-        if($this->db->isISeries){
321
+        if ($this->db->isISeries) {
322 322
             $command->bindValue(':schema', $this->db->defaultSchema);
323
-        }else {
323
+        } else {
324 324
             if (isset($table->schemaName)) {
325 325
                 $command->bindValue(':schema', $table->schemaName);
326 326
             }
@@ -329,22 +329,22 @@  discard block
 block discarded – undo
329 329
         $constraints = $command->queryAll();
330 330
         $constraints = $this->normalizePdoRowKeyCase($constraints, true);
331 331
 
332
-        $constraints = \yii\helpers\ArrayHelper::index($constraints, null, ['name']);
332
+        $constraints = \yii\helpers\ArrayHelper::index($constraints, null, [ 'name' ]);
333 333
 
334 334
         foreach ($constraints as $name => $constraint) {
335 335
             $fks = \yii\helpers\ArrayHelper::getColumn($constraint, 'fk');
336 336
             $pks = \yii\helpers\ArrayHelper::getColumn($constraint, 'pk');
337 337
 
338
-            $tablename = $constraint[0]['tablename'];
338
+            $tablename = $constraint[ 0 ][ 'tablename' ];
339 339
             
340 340
             $keymap = array_combine($fks, $pks);
341 341
 
342
-            $foreignKeys = [$tablename];
342
+            $foreignKeys = [ $tablename ];
343 343
             foreach ($keymap as $fk => $pk) {
344
-                $foreignKeys[$fk] = $pk;
344
+                $foreignKeys[ $fk ] = $pk;
345 345
             }
346 346
 
347
-            $table->foreignKeys[$name] = $foreignKeys;
347
+            $table->foreignKeys[ $name ] = $foreignKeys;
348 348
         }
349 349
     }
350 350
 
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
                   AND qsys2.syscst.table_schema = :schema
370 370
                   ORDER BY qsys2.syskeycst.column_position
371 371
 SQL;
372
-        }else {
372
+        } else {
373 373
             $sql = <<<SQL
374 374
             SELECT
375 375
                 i.indname AS indexname,
@@ -391,9 +391,9 @@  discard block
 block discarded – undo
391 391
         $command = $this->db->createCommand($sql);
392 392
         $command->bindValue(':table', $table->name);
393 393
 
394
-        if($this->db->isISeries){
394
+        if ($this->db->isISeries) {
395 395
             $command->bindValue(':schema', $this->db->defaultSchema);
396
-        }else{
396
+        } else {
397 397
             if (isset($table->schemaName)) {
398 398
                 $command->bindValue(':schema', $table->schemaName);
399 399
             }
@@ -401,9 +401,9 @@  discard block
 block discarded – undo
401 401
         $results = $command->queryAll();
402 402
         $results = $this->normalizePdoRowKeyCase($results, true);
403 403
 
404
-        $indexes = [];
404
+        $indexes = [ ];
405 405
         foreach ($results as $result) {
406
-            $indexes[$result['indexname']][] = $result['column'];
406
+            $indexes[ $result[ 'indexname' ] ][ ] = $result[ 'column' ];
407 407
         }
408 408
         return $indexes;
409 409
     }
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
     {
416 416
 
417 417
         if ($schema === '' && $this->db->isISeries) {
418
-                $schema= $this->db->defaultSchema;
418
+                $schema = $this->db->defaultSchema;
419 419
         }
420 420
 
421 421
         if ($this->db->isISeries) {
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
                   AND TABLE_SCHEMA = :schema
428 428
                 ORDER BY TABLE_NAME
429 429
 SQL;
430
-        }else {
430
+        } else {
431 431
 
432 432
             $sql = <<<SQL
433 433
             SELECT
@@ -531,8 +531,8 @@  discard block
 block discarded – undo
531 531
             } catch (\Exception $ex) {
532 532
                 // Do not throw error on table which doesn't exist (-2211)
533 533
                 // Do not throw error on view (-2212)
534
-                $code = isset($ex->errorInfo[1]) ? $ex->errorInfo[1] : 0;
535
-                if (!in_array($code, [-2211, -2212])) {
534
+                $code = isset($ex->errorInfo[ 1 ]) ? $ex->errorInfo[ 1 ] : 0;
535
+                if (!in_array($code, [-2211, -2212 ])) {
536 536
                     throw new \Exception($ex->getMessage(), $ex->getCode(), $ex->getPrevious());
537 537
                 }
538 538
             }
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
         $columns = \yii\helpers\ArrayHelper::getColumn($constraints, 'column_name');
608 608
         
609 609
         return new \yii\db\Constraint([
610
-            'name' => $constraints[0]['name'],
610
+            'name' => $constraints[ 0 ][ 'name' ],
611 611
             'columnNames' => $columns,
612 612
         ]);
613 613
     }
@@ -644,12 +644,12 @@  discard block
 block discarded – undo
644 644
         
645 645
         $constraints = $command->queryAll();
646 646
         $constraints = $this->normalizePdoRowKeyCase($constraints, true);
647
-        $constraints = \yii\helpers\ArrayHelper::index($constraints, null, ['name']);
648
-        $result = [];
647
+        $constraints = \yii\helpers\ArrayHelper::index($constraints, null, [ 'name' ]);
648
+        $result = [ ];
649 649
         foreach ($constraints as $name => $constraint) {
650 650
             $columns = \yii\helpers\ArrayHelper::getColumn($constraint, 'column_name');
651 651
 
652
-            $result[] = new \yii\db\Constraint([
652
+            $result[ ] = new \yii\db\Constraint([
653 653
                 'name' => $name,
654 654
                 'columnNames' => $columns,
655 655
             ]);
@@ -685,12 +685,12 @@  discard block
 block discarded – undo
685 685
         
686 686
         $constraints = $command->queryAll();
687 687
         $constraints = $this->normalizePdoRowKeyCase($constraints, true);
688
-        $constraints = \yii\helpers\ArrayHelper::index($constraints, null, ['name']);
689
-        $result = [];
688
+        $constraints = \yii\helpers\ArrayHelper::index($constraints, null, [ 'name' ]);
689
+        $result = [ ];
690 690
         foreach ($constraints as $name => $constraint) {
691 691
             $columns = \yii\helpers\ArrayHelper::getColumn($constraint, 'column_name');
692
-            $check_expr = $constraint[0]['check_expr'];
693
-            $result[] = new \yii\db\CheckConstraint([
692
+            $check_expr = $constraint[ 0 ][ 'check_expr' ];
693
+            $result[ ] = new \yii\db\CheckConstraint([
694 694
                 'name' => strtolower(trim($name)),
695 695
                 'columnNames' => $columns,
696 696
                 'expression' => $check_expr,
@@ -727,11 +727,11 @@  discard block
 block discarded – undo
727 727
         $constraints = $command->queryAll();
728 728
         $constraints = $this->normalizePdoRowKeyCase($constraints, true);
729 729
 
730
-        $result = [];
730
+        $result = [ ];
731 731
         foreach ($constraints as $constraint) {
732
-            $columns = [$constraint['column_name']];
733
-            $default_value = $constraint['default_value'];
734
-            $result[] = new \yii\db\DefaultValueConstraint([
732
+            $columns = [ $constraint[ 'column_name' ] ];
733
+            $default_value = $constraint[ 'default_value' ];
734
+            $result[ ] = new \yii\db\DefaultValueConstraint([
735 735
                 'columnNames' => $columns,
736 736
                 'value' => $default_value,
737 737
             ]);
@@ -775,16 +775,16 @@  discard block
 block discarded – undo
775 775
         
776 776
         $constraints = $command->queryAll();
777 777
         $constraints = $this->normalizePdoRowKeyCase($constraints, true);
778
-        $constraints = \yii\helpers\ArrayHelper::index($constraints, null, ['name']);
779
-        $result = [];
778
+        $constraints = \yii\helpers\ArrayHelper::index($constraints, null, [ 'name' ]);
779
+        $result = [ ];
780 780
         foreach ($constraints as $name => $constraint) {
781 781
             $columns = \yii\helpers\ArrayHelper::getColumn($constraint, 'column_name');
782 782
             $foreignColumnNames = \yii\helpers\ArrayHelper::getColumn($constraint, 'ref_column');
783 783
 
784
-            $foreignSchemaName = $constraint[0]['ref_schema'];
785
-            $foreignTableName = $constraint[0]['ref_table'];
786
-            $onDelete = $constraint[0]['on_delete'];
787
-            $onUpdate = $constraint[0]['on_update'];
784
+            $foreignSchemaName = $constraint[ 0 ][ 'ref_schema' ];
785
+            $foreignTableName = $constraint[ 0 ][ 'ref_table' ];
786
+            $onDelete = $constraint[ 0 ][ 'on_delete' ];
787
+            $onUpdate = $constraint[ 0 ][ 'on_update' ];
788 788
             
789 789
             static $onRuleMap = [
790 790
                 'C' => 'CASCADE',
@@ -792,14 +792,14 @@  discard block
 block discarded – undo
792 792
                 'R' => 'RESTRICT',
793 793
             ];
794 794
 
795
-            $result[] = new \yii\db\ForeignKeyConstraint([
795
+            $result[ ] = new \yii\db\ForeignKeyConstraint([
796 796
                 'name' => $name,
797 797
                 'columnNames' => $columns,
798 798
                 'foreignSchemaName' => $foreignSchemaName,
799 799
                 'foreignTableName' => $foreignTableName,
800 800
                 'foreignColumnNames' => $foreignColumnNames,
801
-                'onUpdate' => isset($onRuleMap[$onUpdate]) ? $onRuleMap[$onUpdate] : null,
802
-                'onDelete' => isset($onRuleMap[$onDelete]) ? $onRuleMap[$onDelete] : null,
801
+                'onUpdate' => isset($onRuleMap[ $onUpdate ]) ? $onRuleMap[ $onUpdate ] : null,
802
+                'onDelete' => isset($onRuleMap[ $onDelete ]) ? $onRuleMap[ $onDelete ] : null,
803 803
             ]);
804 804
         }
805 805
         return $result;
@@ -844,15 +844,15 @@  discard block
 block discarded – undo
844 844
         
845 845
         $constraints = $command->queryAll();
846 846
         $constraints = $this->normalizePdoRowKeyCase($constraints, true);
847
-        $constraints = \yii\helpers\ArrayHelper::index($constraints, null, ['name']);
848
-        $result = [];
847
+        $constraints = \yii\helpers\ArrayHelper::index($constraints, null, [ 'name' ]);
848
+        $result = [ ];
849 849
         foreach ($constraints as $name => $constraint) {
850 850
             $columns = \yii\helpers\ArrayHelper::getColumn($constraint, 'column_name');
851 851
 
852
-            $isUnique = $constraint[0]['index_is_unique'];
853
-            $isPrimary = $constraint[0]['index_is_primary'];
852
+            $isUnique = $constraint[ 0 ][ 'index_is_unique' ];
853
+            $isPrimary = $constraint[ 0 ][ 'index_is_primary' ];
854 854
             
855
-            $result[] = new \yii\db\IndexConstraint([
855
+            $result[ ] = new \yii\db\IndexConstraint([
856 856
                 'name' => $name,
857 857
                 'columnNames' => $columns,
858 858
                 'isUnique' => !!$isUnique,
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
         }
870 870
 
871 871
         if ($multiple) {
872
-            return array_map(function (array $row) {
872
+            return array_map(function(array $row) {
873 873
                 return array_change_key_case($row, CASE_LOWER);
874 874
             }, $row);
875 875
         }
Please login to merge, or discard this patch.
src/Connection.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     {
74 74
         parent::initConnection();
75 75
 
76
-        if($this->isISeries === null){
76
+        if ($this->isISeries === null) {
77 77
             try {
78 78
                 $stmt = $this->pdo->query('SELECT * FROM QSYS2.SYSTABLES FETCH FIRST 1 ROW ONLY');
79 79
                 $this->isISeries = boolval($stmt);
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             }
83 83
         }
84 84
 
85
-        if($this->defaultSchema && !$this->isISeries){
85
+        if ($this->defaultSchema && !$this->isISeries) {
86 86
             $this->pdo->exec('SET CURRENT SCHEMA ' . $this->pdo->quote($this->defaultSchema));
87 87
         }
88 88
         
Please login to merge, or discard this patch.
src/conditions/InConditionBuilder.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -18,22 +18,22 @@
 block discarded – undo
18 18
      */
19 19
     protected function buildCompositeInCondition($operator, $columns, $values, &$params)
20 20
     {
21
-        $vss = [];
21
+        $vss = [ ];
22 22
         foreach ($values as $value) {
23
-            $vs = [];
23
+            $vs = [ ];
24 24
             foreach ($columns as $column) {
25
-                if (isset($value[$column])) {
26
-                    $vs[] = $this->queryBuilder->bindParam($value[$column], $params);
25
+                if (isset($value[ $column ])) {
26
+                    $vs[ ] = $this->queryBuilder->bindParam($value[ $column ], $params);
27 27
                 } else {
28
-                    $vs[] = 'NULL';
28
+                    $vs[ ] = 'NULL';
29 29
                 }
30 30
             }
31
-            $vss[] = 'select ' . implode(', ', $vs) . ' from SYSIBM.SYSDUMMY1';
31
+            $vss[ ] = 'select ' . implode(', ', $vs) . ' from SYSIBM.SYSDUMMY1';
32 32
         }
33 33
 
34
-        $sqlColumns = [];
34
+        $sqlColumns = [ ];
35 35
         foreach ($columns as $i => $column) {
36
-            $sqlColumns[] = strpos($column, '(') === false ? $this->queryBuilder->db->quoteColumnName($column) : $column;
36
+            $sqlColumns[ ] = strpos($column, '(') === false ? $this->queryBuilder->db->quoteColumnName($column) : $column;
37 37
         }
38 38
 
39 39
         return '(' . implode(', ', $sqlColumns) . ") $operator (" . implode(' UNION ', $vss) . ')';
Please login to merge, or discard this patch.