| Conditions | 2 |
| Paths | 2 |
| Total Lines | 20 |
| Code Lines | 15 |
| Lines | 20 |
| Ratio | 100 % |
| 1 | <?php |
||
| 16 | public function up() |
||
| 17 | { |
||
| 18 | $tableOptions = null; |
||
| 19 | |||
| 20 | if ($this->db->driverName === 'mysql') { |
||
| 21 | $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB'; |
||
| 22 | } |
||
| 23 | |||
| 24 | $this->createTable('{{%menu_item}}', [ |
||
| 25 | 'id' => Schema::TYPE_PK, |
||
| 26 | 'menu_id' => Schema::TYPE_INTEGER . '(11) NOT NULL', |
||
| 27 | 'label' => Schema::TYPE_STRING . '(255) NOT NULL', |
||
| 28 | 'url' => Schema::TYPE_TEXT . ' NOT NULL', |
||
| 29 | 'description' => Schema::TYPE_TEXT, |
||
| 30 | 'order' => Schema::TYPE_INTEGER . '(11) NOT NULL DEFAULT 0', |
||
| 31 | 'parent' => Schema::TYPE_INTEGER . '(11) NOT NULL DEFAULT 0', |
||
| 32 | 'options' => Schema::TYPE_TEXT, |
||
| 33 | 'FOREIGN KEY ([[menu_id]]) REFERENCES {{%menu}} ([[id]]) ON DELETE CASCADE ON UPDATE CASCADE', |
||
| 34 | ], $tableOptions); |
||
| 35 | } |
||
| 36 | |||
| 45 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.