Completed
Pull Request — master (#191)
by Serhii
02:32
created

Version20210108170343   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 44
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 44
loc 44
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getDescription() 4 4 1
A up() 31 31 1
A down() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

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:

1
<?php
2
3
declare(strict_types=1);
4
5
namespace DoctrineMigrations;
6
7
use Doctrine\DBAL\Schema\Schema;
8
use Doctrine\Migrations\AbstractMigration;
9
10 View Code Duplication
final class Version20210108170343 extends AbstractMigration
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

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.

Loading history...
11
{
12
    public function getDescription() : string
13
    {
14
        return 'Added audience field to performance';
15
    }
16
17
    public function up(Schema $schema) : void
18
    {
19
        $this->addSql('
20
            ALTER TABLE performances 
21
            ADD audience ENUM(\'adults\', \'kids\') DEFAULT \'adults\' NOT NULL COMMENT \'(DC2Type:AudienceEnum)\'
22
        ');
23
24
        $this->addSql('
25
            UPDATE performances 
26
            SET `audience` = \'kids\'
27
            WHERE `slug` IN (
28
                \'popieliushka\',
29
                \'zolotie-kurcha\',
30
                \'dorogha-do-sontsia\',
31
                \'aladdin\',
32
                \'korol-drozdoborod\',
33
                \'kit-u-chobotiakh-1\',
34
                \'troie-porosiat-1\',
35
                \'vsi-mishi-liubliat-sir\',
36
                \'vizok-chudies\',
37
                \'siroyizhka\',
38
                \'koza-dierieza\',
39
                \'korolieva-zagublienikh-g-udzikiv\',
40
                \'kotik-pivnik-i-lisichka\',
41
                \'snigova-korolieva\',
42
                \'rizdvianie-viertiepnie-diistvo\',
43
                \'prigodi-v-krayini-svitloforiyi\',
44
                \'barvinok-ghieroi\'
45
            )
46
        ');
47
    }
48
49
    public function down(Schema $schema) : void
50
    {
51
        $this->addSql('ALTER TABLE performances DROP audience');
52
    }
53
}
54