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 ( f4d474...bcda8c )
by Tarun
03:20
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.
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.
console/controllers/MigrationController.php 1 patch
Braces   +20 added lines, -34 removed lines patch added patch discarded remove patch
@@ -10,8 +10,7 @@  discard block
 block discarded – undo
10 10
 use yii\helpers\Console;
11 11
 use yii\helpers\FileHelper;
12 12
 
13
-class MigrationController extends MigrateController
14
-{
13
+class MigrationController extends MigrateController {
15 14
     use \tmukherjee13\migration\console\components\Formatter;
16 15
 
17 16
     /**
@@ -60,16 +59,14 @@  discard block
 block discarded – undo
60 59
     /**
61 60
      * @inheritdoc
62 61
      */
63
-    public function options($actionID)
64
-    {
62
+    public function options($actionID) {
65 63
         return array_merge(parent::options($actionID), ['migrationTable', 'db']);
66 64
     }
67 65
 
68 66
     /**
69 67
      * @inheritdoc
70 68
      */
71
-    public function beforeAction($action)
72
-    {
69
+    public function beforeAction($action) {
73 70
 
74 71
         if (parent::beforeAction($action)) {
75 72
             if (is_string($this->db)) {
@@ -103,8 +100,7 @@  discard block
 block discarded – undo
103 100
      * Collects the foreign key column details for the given table.
104 101
      * @param TableSchema $table the table metadata
105 102
      */
106
-    protected function findConstraints($table)
107
-    {
103
+    protected function findConstraints($table) {
108 104
         $sql = <<<SQL
109 105
             SELECT
110 106
                 kcu.constraint_name,
@@ -172,20 +168,19 @@  discard block
 block discarded – undo
172 168
      * @param TableSchema $table the table metadata
173 169
      * @return string $sql the result of 'SHOW CREATE TABLE'
174 170
      */
175
-    protected function getCreateTableSql($table)
176
-    {
171
+    protected function getCreateTableSql($table) {
177 172
         $row = $this->db->createCommand('SHOW CREATE TABLE ' . $this->quoteTableName($table->fullName))->queryOne();
178 173
         if (isset($row['Create Table'])) {
179 174
             $sql = $row['Create Table'];
180
-        } else {
175
+        }
176
+        else {
181 177
             $row = array_values($row);
182 178
             $sql = $row[1];
183 179
         }
184 180
         return $sql;
185 181
     }
186 182
 
187
-    public function quoteTableName($name)
188
-    {
183
+    public function quoteTableName($name) {
189 184
         return strpos($name, '`') !== false ? $name : "`$name`";
190 185
     }
191 186
 
@@ -197,8 +192,7 @@  discard block
 block discarded – undo
197 192
      * @author Tarun Mukherjee (https://github.com/tmukherjee13)
198 193
      */
199 194
 
200
-    public function actionTable(array $tables)
201
-    {
195
+    public function actionTable(array $tables) {
202 196
 
203 197
         if ($this->confirm('Create the migration ' . "?")) {
204 198
 
@@ -276,8 +270,7 @@  discard block
 block discarded – undo
276 270
      * @param array $tables the list of tables
277 271
      * @return integer|null
278 272
      */
279
-    public function actionData(array $tables)
280
-    {
273
+    public function actionData(array $tables) {
281 274
 
282 275
         if ($this->confirm('Create the migration ' . "?", true)) {
283 276
             foreach ($tables as $key => $args) {
@@ -319,7 +312,8 @@  discard block
 block discarded – undo
319 312
 
320 313
                     if (empty($prepared_data)) {
321 314
                         $this->stdout("\nTable '{$table->name}' doesn't contain any data.\n\n", Console::FG_RED);
322
-                    } else {
315
+                    }
316
+                    else {
323 317
                         $pcolumns = $this->prepareColumns($pcolumns);
324 318
                         $prows    = $this->prepareData($prepared_data);
325 319
 
@@ -339,8 +333,7 @@  discard block
 block discarded – undo
339 333
      * @param string $args the schema name
340 334
      * @return integer
341 335
      */
342
-    public function actionSchema($args)
343
-    {
336
+    public function actionSchema($args) {
344 337
 
345 338
         $schema      = $args;
346 339
         $this->class = 'dump_database_' . $schema;
@@ -368,18 +361,15 @@  discard block
 block discarded – undo
368 361
 
369 362
     }
370 363
 
371
-    public function getFileName()
372
-    {
364
+    public function getFileName() {
373 365
         return 'm' . gmdate('ymd_His') . '_' . $this->class;
374 366
     }
375 367
 
376
-    public function setFileName()
377
-    {
368
+    public function setFileName() {
378 369
         $this->fileName = $this->getFileName();
379 370
     }
380 371
 
381
-    public function prepareFile($data)
382
-    {
372
+    public function prepareFile($data) {
383 373
         $file = $this->migrationPath . DIRECTORY_SEPARATOR . $this->getFileName() . '.php';
384 374
         try {
385 375
 
@@ -399,8 +389,7 @@  discard block
 block discarded – undo
399 389
     /**
400 390
      * @inheritdoc
401 391
      */
402
-    protected function getMigrationHistory($limit)
403
-    {
392
+    protected function getMigrationHistory($limit) {
404 393
         if ($this->db->schema->getTableSchema($this->migrationTable, true) === null) {
405 394
             $this->createMigrationHistoryTable();
406 395
         }
@@ -420,8 +409,7 @@  discard block
 block discarded – undo
420 409
     /**
421 410
      * @inheritdoc
422 411
      */
423
-    protected function addMigrationHistory($version)
424
-    {
412
+    protected function addMigrationHistory($version) {
425 413
         $command = $this->db->createCommand();
426 414
         $command->insert($this->migrationTable, [
427 415
             'version'    => $version,
@@ -432,8 +420,7 @@  discard block
 block discarded – undo
432 420
     /**
433 421
      * @inheritdoc
434 422
      */
435
-    protected function removeMigrationHistory($version)
436
-    {
423
+    protected function removeMigrationHistory($version) {
437 424
         $command = $this->db->createCommand();
438 425
         $command->delete($this->migrationTable, [
439 426
             'version' => $version,
@@ -443,8 +430,7 @@  discard block
 block discarded – undo
443 430
     /**
444 431
      * @inheritdoc
445 432
      */
446
-    protected function parseFields()
447
-    {
433
+    protected function parseFields() {
448 434
         $fields = [];
449 435
 
450 436
         foreach ($this->fields as $column => $schema) {
Please login to merge, or discard this patch.