Version20160823172700   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 33
loc 33
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 20 20 1
A down() 3 3 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
namespace DoctrineMigrations;
4
5
use Doctrine\DBAL\Migrations\AbstractMigration;
6
use Doctrine\DBAL\Schema\Schema;
7
use Doctrine\ORM\EntityManager;
8
use Eccube\Entity\PageLayout;
9
10 View Code Duplication
class Version20160823172700 extends AbstractMigration
0 ignored issues
show
introduced by
Missing class doc comment
Loading history...
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
    /**
13
     * @param Schema $schema
14
     */
15
    public function up(Schema $schema)
16
    {
17
        $app = \Eccube\Application::getInstance();
18
        /** @var EntityManager $em */
19
        $em = $app["orm.em"];
20
21
        $DeviceType = $app['eccube.repository.master.device_type']->find(10);
22
23
        $PageLayout = new PageLayout();
24
        $PageLayout
25
            ->setDeviceType($DeviceType)
26
            ->setName('MYページ/お届け先編集')
27
            ->setUrl('mypage_delivery_edit')
28
            ->setFileName('Mypage/delivery_edit')
29
            ->setEditFlg(2)
30
            ->setMetaRobots('noindex');
31
        $em->persist($PageLayout);
32
33
        $em->flush();
34
    }
35
36
    /**
37
     * @param Schema $schema
38
     */
39
    public function down(Schema $schema)
40
    {
41
    }
42
}
43