GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 09a29f...5af058 )
by Tarun
45s
created
console/controllers/MigrationController.php 1 patch
Braces   +23 added lines, -40 removed lines patch added patch discarded remove patch
@@ -12,8 +12,7 @@  discard block
 block discarded – undo
12 12
 use yii\console\controllers\MigrateController;
13 13
 
14 14
 
15
-class MigrationController extends MigrateController
16
-{
15
+class MigrationController extends MigrateController {
17 16
     use \tmukherjee13\migration\console\components\Formatter;
18 17
     
19 18
     /**
@@ -54,16 +53,14 @@  discard block
 block discarded – undo
54 53
     /**
55 54
      * @inheritdoc
56 55
      */
57
-    public function options($actionID)
58
-    {
56
+    public function options($actionID) {
59 57
         return array_merge(parent::options($actionID), ['migrationTable', 'db']);
60 58
     }
61 59
     
62 60
     /**
63 61
      * @inheritdoc
64 62
      */
65
-    public function beforeAction($action)
66
-    {
63
+    public function beforeAction($action) {
67 64
         
68 65
         if (parent::beforeAction($action)) {
69 66
             if (is_string($this->db)) {
@@ -100,8 +97,7 @@  discard block
 block discarded – undo
100 97
      *
101 98
      * @return int
102 99
      */
103
-    public function actionUpData($limit = 0)
104
-    {
100
+    public function actionUpData($limit = 0) {
105 101
         $this->migrationPath .= DIRECTORY_SEPARATOR . $this->dataMigrationFolder;
106 102
         return parent::actionUp($limit);
107 103
     }
@@ -116,8 +112,7 @@  discard block
 block discarded – undo
116 112
      * @throws \yii\console\Exception
117 113
      * @throws \yii\db\Exception
118 114
      */
119
-    public function actionData(array $tables)
120
-    {
115
+    public function actionData(array $tables) {
121 116
         if ($this->confirm('Create the migration ' . "?", TRUE)) {
122 117
             foreach ($tables as $key => $args) {
123 118
                 
@@ -158,7 +153,8 @@  discard block
 block discarded – undo
158 153
                     
159 154
                     if (empty($prepared_data)) {
160 155
                         $this->stdout("\nTable '{$table->name}' doesn't contain any data.\n\n", Console::FG_RED);
161
-                    } else {
156
+                    }
157
+                    else {
162 158
                         $pcolumns = $this->prepareColumns($pcolumns);
163 159
                         $prows = $this->prepareData($prepared_data);
164 160
                         
@@ -179,16 +175,14 @@  discard block
 block discarded – undo
179 175
     /**
180 176
      * @return string
181 177
      */
182
-    public function getFileName()
183
-    {
178
+    public function getFileName() {
184 179
         return 'm' . gmdate('ymd_His') . '_' . $this->class;
185 180
     }
186 181
     
187 182
     /**
188 183
      *
189 184
      */
190
-    public function setFileName()
191
-    {
185
+    public function setFileName() {
192 186
         $this->fileName = $this->getFileName();
193 187
     }
194 188
     
@@ -198,8 +192,7 @@  discard block
 block discarded – undo
198 192
      * @return string
199 193
      * @throws \yii\console\Exception
200 194
      */
201
-    public function prepareFile($data)
202
-    {
195
+    public function prepareFile($data) {
203 196
         $file = $this->migrationPath . DIRECTORY_SEPARATOR . $this->getFileName() . '.php';
204 197
         try {
205 198
             
@@ -222,8 +215,7 @@  discard block
 block discarded – undo
222 215
      * @return int
223 216
      * @throws \yii\console\Exception
224 217
      */
225
-    public function actionSchema($args)
226
-    {
218
+    public function actionSchema($args) {
227 219
         
228 220
         $schema = $args;
229 221
         $this->class = 'dump_database_' . $schema;
@@ -257,8 +249,7 @@  discard block
 block discarded – undo
257 249
      * @return mixed
258 250
      * @author Tarun Mukherjee (https://github.com/tmukherjee13)
259 251
      */
260
-    public function actionTable(array $tables)
261
-    {
252
+    public function actionTable(array $tables) {
262 253
         
263 254
         if (!$this->confirm('Create the migration ' . "?")) {
264 255
             return;
@@ -343,8 +334,7 @@  discard block
 block discarded – undo
343 334
      * @return array
344 335
      * @throws \yii\db\Exception
345 336
      */
346
-    protected function findConstraints($table)
347
-    {
337
+    protected function findConstraints($table) {
348 338
         $sql = <<<SQL
349 339
             SELECT
350 340
                 kcu.constraint_name,
@@ -415,12 +405,12 @@  discard block
 block discarded – undo
415 405
      * @return mixed
416 406
      * @throws \yii\db\Exception
417 407
      */
418
-    protected function getCreateTableSql(TableSchema $table)
419
-    {
408
+    protected function getCreateTableSql(TableSchema $table) {
420 409
         $row = $this->db->createCommand('SHOW CREATE TABLE ' . $this->quoteTableName($table->fullName))->queryOne();
421 410
         if (isset($row['Create Table'])) {
422 411
             $sql = $row['Create Table'];
423
-        } else {
412
+        }
413
+        else {
424 414
             $row = array_values($row);
425 415
             $sql = $row[1];
426 416
         }
@@ -432,16 +422,14 @@  discard block
 block discarded – undo
432 422
      *
433 423
      * @return string
434 424
      */
435
-    public function quoteTableName($name)
436
-    {
425
+    public function quoteTableName($name) {
437 426
         return strpos($name, '`') !== FALSE ? $name : "`$name`";
438 427
     }
439 428
     
440 429
     /**
441 430
      * @inheritdoc
442 431
      */
443
-    protected function parseFields()
444
-    {
432
+    protected function parseFields() {
445 433
         $fields = [];
446 434
         
447 435
         foreach ($this->fields as $column => $schema) {
@@ -480,8 +468,7 @@  discard block
 block discarded – undo
480 468
      *
481 469
      * @return array|void
482 470
      */
483
-    protected function findIndexes(TableSchema $table)
484
-    {
471
+    protected function findIndexes(TableSchema $table) {
485 472
         $sql = "SHOW INDEX FROM `{$table->name}`";
486 473
         
487 474
         try {
@@ -506,8 +493,7 @@  discard block
 block discarded – undo
506 493
      *
507 494
      * @return array
508 495
      */
509
-    public function filterKeyIndex($table, array $rows = [])
510
-    {
496
+    public function filterKeyIndex($table, array $rows = []) {
511 497
         $return = [];
512 498
         foreach ($rows as $row) {
513 499
             
@@ -542,8 +528,7 @@  discard block
 block discarded – undo
542 528
     /**
543 529
      * @inheritdoc
544 530
      */
545
-    protected function getMigrationHistory($limit)
546
-    {
531
+    protected function getMigrationHistory($limit) {
547 532
         if ($this->db->schema->getTableSchema($this->migrationTable, TRUE) === NULL) {
548 533
             $this->createMigrationHistoryTable();
549 534
         }
@@ -563,8 +548,7 @@  discard block
 block discarded – undo
563 548
     /**
564 549
      * @inheritdoc
565 550
      */
566
-    protected function addMigrationHistory($version)
567
-    {
551
+    protected function addMigrationHistory($version) {
568 552
         $command = $this->db->createCommand();
569 553
         $command->insert($this->migrationTable, [
570 554
             'version'    => $version,
@@ -575,8 +559,7 @@  discard block
 block discarded – undo
575 559
     /**
576 560
      * @inheritdoc
577 561
      */
578
-    protected function removeMigrationHistory($version)
579
-    {
562
+    protected function removeMigrationHistory($version) {
580 563
         $command = $this->db->createCommand();
581 564
         $command->delete($this->migrationTable, [
582 565
             'version' => $version,
Please login to merge, or discard this patch.
console/components/Formatter.php 1 patch
Braces   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -7,8 +7,7 @@  discard block
 block discarded – undo
7 7
 /**
8 8
  * Table class
9 9
  */
10
-trait Formatter
11
-{
10
+trait Formatter {
12 11
     /**
13 12
      * @var array column enclosing literal
14 13
      */
@@ -43,8 +42,7 @@  discard block
 block discarded – undo
43 42
      * @return string
44 43
      * @author Tarun Mukherjee (https://github.com/tmukherjee13)
45 44
      */
46
-    public function getTableName($table)
47
-    {
45
+    public function getTableName($table) {
48 46
         return '{{%' . str_replace($this->db->tablePrefix, '', $table->name) . '}}';
49 47
     }
50 48
     
@@ -54,8 +52,7 @@  discard block
 block discarded – undo
54 52
      *
55 53
      * @return string
56 54
      */
57
-    public function prepareInsert($rows, $columns)
58
-    {
55
+    public function prepareInsert($rows, $columns) {
59 56
         return '$this->batchInsert("{{%test}}", ' . $rows . ', ' . $columns . ');';
60 57
     }
61 58
     
@@ -66,8 +63,7 @@  discard block
 block discarded – undo
66 63
      *
67 64
      * @return string
68 65
      */
69
-    public function prepareColumns($data, $trim = ',')
70
-    {
66
+    public function prepareColumns($data, $trim = ',') {
71 67
         return self::columnFormat($data, $trim);
72 68
     }
73 69
     
@@ -78,8 +74,7 @@  discard block
 block discarded – undo
78 74
      *
79 75
      * @return string
80 76
      */
81
-    public function columnFormat($data, $trim = ',')
82
-    {
77
+    public function columnFormat($data, $trim = ',') {
83 78
         if (NULL !== $trim) {
84 79
             $data = rtrim($data, $trim);
85 80
         }
@@ -94,8 +89,7 @@  discard block
 block discarded – undo
94 89
      *
95 90
      * @return string
96 91
      */
97
-    public function prepareData($data = [])
98
-    {
92
+    public function prepareData($data = []) {
99 93
         self::$rows = '';
100 94
         foreach ($data as $row) {
101 95
             $rows = '';
@@ -117,8 +111,7 @@  discard block
 block discarded – undo
117 111
      *
118 112
      * @return string
119 113
      */
120
-    public function dataFormat($data, $trim = ',')
121
-    {
114
+    public function dataFormat($data, $trim = ',') {
122 115
         if (NULL !== $trim) {
123 116
             $data = rtrim($data, $trim);
124 117
         }
@@ -135,8 +128,7 @@  discard block
 block discarded – undo
135 128
      * @author Tarun Mukherjee (https://github.com/tmukherjee13)
136 129
      */
137 130
     
138
-    public function formatCol($col)
139
-    {
131
+    public function formatCol($col) {
140 132
         if (!empty($col->enumValues)) {
141 133
             return $this->getColType($col);
142 134
         }
@@ -144,14 +136,18 @@  discard block
 block discarded – undo
144 136
         $decorator = [];
145 137
         if ($col->isPrimaryKey && $col->autoIncrement) {
146 138
             $decorator[] = 'primaryKey';
147
-        } elseif (in_array($col->type, self::$colTypes)) {
139
+        }
140
+        elseif (in_array($col->type, self::$colTypes)) {
148 141
             $decorator[] = "{$this->modifyColType($col->dbType)}";
149
-        } elseif ($col->type == 'decimal') {
142
+        }
143
+        elseif ($col->type == 'decimal') {
150 144
             $decorator[] = "{$col->dbType}";
151
-        } else {
145
+        }
146
+        else {
152 147
             if (!empty($col->size) && $col->size == 1 && $col->type != 'char') {
153 148
                 $column = "boolean";
154
-            } else {
149
+            }
150
+            else {
155 151
                 $column = "{$col->type}";
156 152
                 if (!empty($col->size)) {
157 153
                     $column .= "({$col->size})";
@@ -171,9 +167,11 @@  discard block
 block discarded – undo
171 167
         // default value.
172 168
         if (is_a($col->defaultValue, Expression::class)) {
173 169
             $decorator[] = "defaultExpression('{$col->defaultValue}')";
174
-        } elseif (is_numeric($col->defaultValue)) {
170
+        }
171
+        elseif (is_numeric($col->defaultValue)) {
175 172
             $decorator[] = "defaultValue({$col->defaultValue})";
176
-        } elseif (!empty($col->defaultValue)) {
173
+        }
174
+        elseif (!empty($col->defaultValue)) {
177 175
             $decorator[] = "defaultValue('{$col->defaultValue}')";
178 176
         }
179 177
         
@@ -193,8 +191,7 @@  discard block
 block discarded – undo
193 191
      * @return string
194 192
      * @author Tarun Mukherjee (https://github.com/tmukherjee13)
195 193
      */
196
-    public function getColType($col)
197
-    {
194
+    public function getColType($col) {
198 195
         if ($col->isPrimaryKey && $col->autoIncrement) {
199 196
             return 'pk';
200 197
         }
@@ -205,11 +202,14 @@  discard block
 block discarded – undo
205 202
         }
206 203
         if ($col->defaultValue != NULL && 'timestamp' != $col->dbType) {
207 204
             $result .= " DEFAULT '{$col->defaultValue}'";
208
-        } elseif ($col->defaultValue == 'CURRENT_TIMESTAMP' && 'timestamp' == $col->dbType) {
205
+        }
206
+        elseif ($col->defaultValue == 'CURRENT_TIMESTAMP' && 'timestamp' == $col->dbType) {
209 207
             $result .= " DEFAULT {$col->defaultValue}";
210
-        } elseif ($col->defaultValue != NULL && 'timestamp' == $col->dbType) {
208
+        }
209
+        elseif ($col->defaultValue != NULL && 'timestamp' == $col->dbType) {
211 210
             $result .= " DEFAULT '{$col->defaultValue}'";
212
-        } elseif ($col->allowNull) {
211
+        }
212
+        elseif ($col->allowNull) {
213 213
             $result .= ' DEFAULT NULL';
214 214
         }
215 215
         return $result;
Please login to merge, or discard this patch.
views/_dropIndexes.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 /* @var $table string the name table */
3 3
 /* @var $indexes array the foreign keys */
4 4
 
5
-if($indexes){
5
+if($indexes) {
6 6
         foreach ($indexes as $key => $index): ?>
7 7
                 $this->dropIndex('<?= $key ?>', $this->tableName);
8 8
         <?php endforeach;
Please login to merge, or discard this patch.
views/_addIndexes.php 1 patch
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,16 +8,22 @@
 block discarded – undo
8 8
 
9 9
 //dd( $indexes );
10 10
 
11
-if($indexes){
11
+if($indexes) {
12 12
         foreach ($indexes as $index):
13 13
         if(is_string($index['Column_name'])): ?>
14 14
         <?php if($index['Non_unique'] == 0): ?>
15 15
                 $this->createIndex('<?= str_replace('_UNIQUE', '', $index['Key_name'])?>', $this->tableName, '<?= $index['Column_name'] ?>', true);
16
-        <?php else: ?>
16
+        <?php else {
17
+    : ?>
17 18
                 $this->createIndex('<?= $index['Key_name']  ?>', $this->tableName, '<?= $index['Column_name'] ?>');
18
-        <?php endif; ?>
19
-        <?php else: ?>
19
+        <?php endif;
20
+}
21
+?>
22
+        <?php else {
23
+    : ?>
20 24
                 $this->createIndex('<?= $index['Key_name']  ?>', $this->tableName, ['<?= implode("','",$index['Column_name']) ?>']);
21
-        <?php endif; ?>
25
+        <?php endif;
26
+}
27
+?>
22 28
         <?php endforeach;
23 29
 }
Please login to merge, or discard this patch.
views/_createTable.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,9 +15,11 @@
 block discarded – undo
15 15
         <?= "'{$field['property']}' => \$this->{$field['decorators']}" ?>,
16 16
     <?php elseif(!empty('raw')): ?>
17 17
         <?=$field['raw'] ?>,
18
-    <?php else: ?>
18
+    <?php else {
19
+    : ?>
19 20
         '<?= $field['property'] ?>',
20 21
     <?php endif;
22
+}
21 23
 endforeach; ?>
22 24
     ], $collation);
23 25
 
Please login to merge, or discard this patch.