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
Branch master (f1d19b)
by Tarun
03:06
created
console/components/Formatter.php 1 patch
Braces   +23 added lines, -25 removed lines patch added patch discarded remove patch
@@ -5,8 +5,7 @@  discard block
 block discarded – undo
5 5
 /**
6 6
  * Table class
7 7
  */
8
-trait Formatter
9
-{
8
+trait Formatter {
10 9
 
11 10
     /**
12 11
      * @var array column enclosing literal
@@ -41,15 +40,13 @@  discard block
 block discarded – undo
41 40
      * @author Tarun Mukherjee (https://github.com/tmukherjee13)
42 41
      */
43 42
 
44
-    public function getTableName($table)
45
-    {
43
+    public function getTableName($table) {
46 44
         return '{{%' . str_replace($this->db->tablePrefix, '', $table->name) . '}}';
47 45
     }
48 46
 
49 47
 
50 48
     
51
-    public function prepareInsert($rows, $columns)
52
-    {
49
+    public function prepareInsert($rows, $columns) {
53 50
 
54 51
         
55 52
         return '$this->batchInsert("{{%test}}", ' . $rows . ', ' . $columns . ');';
@@ -60,8 +57,7 @@  discard block
 block discarded – undo
60 57
      * @param string $data the column string|$trim the literal to trim
61 58
      * @return string
62 59
      */
63
-    public function prepareColumns($data, $trim = ',')
64
-    {
60
+    public function prepareColumns($data, $trim = ',') {
65 61
         return self::columnFormat($data, $trim);
66 62
     }
67 63
 
@@ -70,8 +66,7 @@  discard block
 block discarded – undo
70 66
      * @param array $data the data array
71 67
      * @return string
72 68
      */
73
-    public function prepareData($data = [])
74
-    {
69
+    public function prepareData($data = []) {
75 70
         self::$rows = '';
76 71
         foreach ($data as $row) {
77 72
             $rows = '';
@@ -91,8 +86,7 @@  discard block
 block discarded – undo
91 86
      * @param string $data the column string|$trim the literal to trim
92 87
      * @return string
93 88
      */
94
-    public function dataFormat($data, $trim = ',')
95
-    {
89
+    public function dataFormat($data, $trim = ',') {
96 90
         if (null !== $trim) {
97 91
             $data = rtrim($data, $trim);
98 92
         }
@@ -104,8 +98,7 @@  discard block
 block discarded – undo
104 98
      * @param string $data the column string|$trim the literal to trim
105 99
      * @return string
106 100
      */
107
-    public function columnFormat($data, $trim = ',')
108
-    {
101
+    public function columnFormat($data, $trim = ',') {
109 102
         if (null !== $trim) {
110 103
             $data = rtrim($data, $trim);
111 104
         }
@@ -122,8 +115,7 @@  discard block
 block discarded – undo
122 115
      * @author Tarun Mukherjee (https://github.com/tmukherjee13)
123 116
      */
124 117
 
125
-    public function getColType($col)
126
-    {
118
+    public function getColType($col) {
127 119
 
128 120
         if ($col->isPrimaryKey && $col->autoIncrement) {
129 121
             return 'pk';
@@ -135,11 +127,14 @@  discard block
 block discarded – undo
135 127
         }
136 128
         if ($col->defaultValue != null && 'timestamp' != $col->dbType) {
137 129
             $result .= " DEFAULT '{$col->defaultValue}'";
138
-        } elseif ($col->defaultValue == 'CURRENT_TIMESTAMP' && 'timestamp' == $col->dbType) {
130
+        }
131
+        elseif ($col->defaultValue == 'CURRENT_TIMESTAMP' && 'timestamp' == $col->dbType) {
139 132
             $result .= " DEFAULT {$col->defaultValue}";
140
-        } elseif ($col->defaultValue != null && 'timestamp' == $col->dbType) {
133
+        }
134
+        elseif ($col->defaultValue != null && 'timestamp' == $col->dbType) {
141 135
             $result .= " DEFAULT '{$col->defaultValue}'";
142
-        } elseif ($col->allowNull) {
136
+        }
137
+        elseif ($col->allowNull) {
143 138
             $result .= ' DEFAULT NULL';
144 139
         }
145 140
         return $result;
@@ -154,19 +149,22 @@  discard block
 block discarded – undo
154 149
      * @author Tarun Mukherjee (https://github.com/tmukherjee13)
155 150
      */
156 151
 
157
-    public function formatCol($col)
158
-    {
152
+    public function formatCol($col) {
159 153
         $decorator = [];
160 154
         if ($col->isPrimaryKey && $col->autoIncrement) {
161 155
             $decorator[] = 'primaryKey';
162
-        } elseif (in_array($col->type, self::$colTypes)) {
156
+        }
157
+        elseif (in_array($col->type, self::$colTypes)) {
163 158
             $decorator[] = "{$col->phpType}";
164
-        } elseif ($col->type == 'decimal') {
159
+        }
160
+        elseif ($col->type == 'decimal') {
165 161
             $decorator[] = "{$col->dbType}";
166
-        } else {
162
+        }
163
+        else {
167 164
             if (!empty($col->size) && $col->size == 1 && $col->type != 'char') {
168 165
                 $column = "boolean";
169
-            } else {
166
+            }
167
+            else {
170 168
                 $column = "{$col->type}";
171 169
                 if (!empty($col->size)) {
172 170
                     $column .= "({$col->size})";
Please login to merge, or discard this patch.
console/controllers/MigrationController.php 1 patch
Braces   +20 added lines, -34 removed lines patch added patch discarded remove patch
@@ -9,8 +9,7 @@  discard block
 block discarded – undo
9 9
 use yii\helpers\Console;
10 10
 use yii\helpers\FileHelper;
11 11
 
12
-class MigrationController extends BaseMigrateController
13
-{
12
+class MigrationController extends BaseMigrateController {
14 13
     use \tmukherjee13\migration\console\components\Formatter;
15 14
 
16 15
     /**
@@ -59,16 +58,14 @@  discard block
 block discarded – undo
59 58
     /**
60 59
      * @inheritdoc
61 60
      */
62
-    public function options($actionID)
63
-    {
61
+    public function options($actionID) {
64 62
         return array_merge(parent::options($actionID), ['migrationTable', 'db']);
65 63
     }
66 64
 
67 65
     /**
68 66
      * @inheritdoc
69 67
      */
70
-    public function beforeAction($action)
71
-    {
68
+    public function beforeAction($action) {
72 69
 
73 70
         if (parent::beforeAction($action)) {
74 71
             if (is_string($this->db)) {
@@ -102,8 +99,7 @@  discard block
 block discarded – undo
102 99
      * Collects the foreign key column details for the given table.
103 100
      * @param TableSchema $table the table metadata
104 101
      */
105
-    protected function findConstraints($table)
106
-    {
102
+    protected function findConstraints($table) {
107 103
         $sql = <<<SQL
108 104
             SELECT
109 105
                 kcu.constraint_name,
@@ -171,20 +167,19 @@  discard block
 block discarded – undo
171 167
      * @param TableSchema $table the table metadata
172 168
      * @return string $sql the result of 'SHOW CREATE TABLE'
173 169
      */
174
-    protected function getCreateTableSql($table)
175
-    {
170
+    protected function getCreateTableSql($table) {
176 171
         $row = $this->db->createCommand('SHOW CREATE TABLE ' . $this->quoteTableName($table->fullName))->queryOne();
177 172
         if (isset($row['Create Table'])) {
178 173
             $sql = $row['Create Table'];
179
-        } else {
174
+        }
175
+        else {
180 176
             $row = array_values($row);
181 177
             $sql = $row[1];
182 178
         }
183 179
         return $sql;
184 180
     }
185 181
 
186
-    public function quoteTableName($name)
187
-    {
182
+    public function quoteTableName($name) {
188 183
         return strpos($name, '`') !== false ? $name : "`$name`";
189 184
     }
190 185
 
@@ -196,8 +191,7 @@  discard block
 block discarded – undo
196 191
      * @author Tarun Mukherjee (https://github.com/tmukherjee13)
197 192
      */
198 193
 
199
-    public function actionTable(array $tables)
200
-    {
194
+    public function actionTable(array $tables) {
201 195
 
202 196
         if ($this->confirm('Create the migration ' . "?")) {
203 197
 
@@ -275,8 +269,7 @@  discard block
 block discarded – undo
275 269
      * @param array $tables the list of tables
276 270
      * @return integer|null
277 271
      */
278
-    public function actionData(array $tables)
279
-    {
272
+    public function actionData(array $tables) {
280 273
 
281 274
         if ($this->confirm('Create the migration ' . "?", true)) {
282 275
             foreach ($tables as $key => $args) {
@@ -318,7 +311,8 @@  discard block
 block discarded – undo
318 311
 
319 312
                     if (empty($prepared_data)) {
320 313
                         $this->stdout("\nTable '{$table->name}' doesn't contain any data.\n\n", Console::FG_RED);
321
-                    } else {
314
+                    }
315
+                    else {
322 316
                         $pcolumns = $this->prepareColumns($pcolumns);
323 317
                         $prows    = $this->prepareData($prepared_data);
324 318
 
@@ -338,8 +332,7 @@  discard block
 block discarded – undo
338 332
      * @param string $args the schema name
339 333
      * @return integer
340 334
      */
341
-    public function actionSchema($args)
342
-    {
335
+    public function actionSchema($args) {
343 336
 
344 337
         $schema      = $args;
345 338
         $this->class = 'dump_database_' . $schema;
@@ -367,18 +360,15 @@  discard block
 block discarded – undo
367 360
 
368 361
     }
369 362
 
370
-    public function getFileName()
371
-    {
363
+    public function getFileName() {
372 364
         return 'm' . gmdate('ymd_His') . '_' . $this->class;
373 365
     }
374 366
 
375
-    public function setFileName()
376
-    {
367
+    public function setFileName() {
377 368
         $this->fileName = $this->getFileName();
378 369
     }
379 370
 
380
-    public function prepareFile($data)
381
-    {
371
+    public function prepareFile($data) {
382 372
         $file = $this->migrationPath . DIRECTORY_SEPARATOR . $this->getFileName() . '.php';
383 373
         try {
384 374
 
@@ -398,8 +388,7 @@  discard block
 block discarded – undo
398 388
     /**
399 389
      * @inheritdoc
400 390
      */
401
-    protected function getMigrationHistory($limit)
402
-    {
391
+    protected function getMigrationHistory($limit) {
403 392
         if ($this->db->schema->getTableSchema($this->migrationTable, true) === null) {
404 393
             $this->createMigrationHistoryTable();
405 394
         }
@@ -419,8 +408,7 @@  discard block
 block discarded – undo
419 408
     /**
420 409
      * @inheritdoc
421 410
      */
422
-    protected function addMigrationHistory($version)
423
-    {
411
+    protected function addMigrationHistory($version) {
424 412
         $command = $this->db->createCommand();
425 413
         $command->insert($this->migrationTable, [
426 414
             'version'    => $version,
@@ -431,8 +419,7 @@  discard block
 block discarded – undo
431 419
     /**
432 420
      * @inheritdoc
433 421
      */
434
-    protected function removeMigrationHistory($version)
435
-    {
422
+    protected function removeMigrationHistory($version) {
436 423
         $command = $this->db->createCommand();
437 424
         $command->delete($this->migrationTable, [
438 425
             'version' => $version,
@@ -442,8 +429,7 @@  discard block
 block discarded – undo
442 429
     /**
443 430
      * @inheritdoc
444 431
      */
445
-    protected function parseFields()
446
-    {
432
+    protected function parseFields() {
447 433
         $fields = [];
448 434
 
449 435
         foreach ($this->fields as $column => $schema) {
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
@@ -13,9 +13,11 @@
 block discarded – undo
13 13
     if (empty($field['decorators'])): ?>
14 14
             '<?= $field['property'] ?>',
15 15
 
16
-<?php else: ?>
16
+<?php else {
17
+    : ?>
17 18
             <?= "'{$field['property']}' => \$this->{$field['decorators']}" ?>,
18 19
 <?php endif;
20
+}
19 21
 
20 22
 endforeach; ?>
21 23
 
Please login to merge, or discard this patch.