Failed Conditions
Push — master ( 746c21...bb3715 )
by Kentaro
35:35
created

Version20160908161616   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 68.75 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 22
loc 32
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 12 12 2
A down() 10 10 2

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
namespace DoctrineMigrations;
4
5
use Doctrine\DBAL\Migrations\AbstractMigration;
6
use Doctrine\DBAL\Schema\Schema;
7
8
class Version20160908161616 extends AbstractMigration
0 ignored issues
show
introduced by
Missing class doc comment
Loading history...
9
{
10
    /**
11
     * @param Schema $schema
12
     */
13 View Code Duplication
    public function up(Schema $schema)
0 ignored issues
show
Duplication introduced by
This method 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...
14
    {
15
        // DeliveryDate のお届け日数を修正
16
        // see https://github.com/EC-CUBE/ec-cube/issues/1732
17
        $app = \Eccube\Application::getInstance();
18
        $em = $app["orm.em"];
19
        $DeliveryDate = $app['eccube.repository.delivery_date']->find(9);
20
        if ($DeliveryDate->getValue() === 0) {
21
            $DeliveryDate->setValue(-1);
22
            $em->flush($DeliveryDate);
23
        }
24
    }
25
26
    /**
27
     * @param Schema $schema
28
     */
29 View Code Duplication
    public function down(Schema $schema)
0 ignored issues
show
Duplication introduced by
This method 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...
30
    {
31
        $app = \Eccube\Application::getInstance();
32
        $em = $app["orm.em"];
33
        $DeliveryDate = $app['eccube.repository.delivery_date']->find(9);
34
        if ($DeliveryDate->getValue() === -1) {
35
            $DeliveryDate->setValue(0);
36
            $em->flush($DeliveryDate);
37
        }
38
    }
39
}
40