for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
<?php
use yii\db\Migration;
/**
* Handles the creation of table `qualities`.
*/
class m190220_013101_create_qualities_table extends Migration
{
* {@inheritdoc}
public function safeUp()
$this->createTable('qualities',
[
'id' => $this->primaryKey(),
'title' => $this->string(128)->notNull(),
'description' => $this->text()->notNull(),
'icon' => $this->string(128)->notNull(),
'created_at' => $this->dateTime(),
'updated_at' => $this->dateTime(),
]
);
}
public function safeDown()
$this->dropTable('qualities');