Completed
Push — 1.8 ( 8d6730...a2d9e7 )
by
unknown
42:28
created

OroCRMCallBundle   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 59
Duplicated Lines 61.02 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 36
loc 59
rs 10
c 2
b 1
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 5 1
A createCallDirectionTranslationTable() 18 18 1
A createCallStatusTranslationTable() 18 18 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 OroCRM\Bundle\CallBundle\Migrations\Schema\v1_6;
4
5
use Doctrine\DBAL\Schema\Schema;
6
7
use Oro\Bundle\MigrationBundle\Migration\Migration;
8
use Oro\Bundle\MigrationBundle\Migration\QueryBag;
9
10
class OroCRMCallBundle implements Migration
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function up(Schema $schema, QueryBag $queries)
16
    {
17
        self::createCallDirectionTranslationTable($schema);
18
        self::createCallStatusTranslationTable($schema);
19
    }
20
21
    /**
22
     * Generate table orocrm_call_direction_trans
23
     *
24
     * @param Schema $schema
25
     */
26 View Code Duplication
    public static function createCallDirectionTranslationTable(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...
27
    {
28
        /** Generate table orocrm_call_direction_trans **/
29
        $table = $schema->createTable('orocrm_call_direction_trans');
30
        $table->addColumn('id', 'integer', array('autoincrement' => true));
31
        $table->addColumn('foreign_key', 'string', array('length' => 32));
32
        $table->addColumn('content', 'string', array('length' => 255));
33
        $table->addColumn('locale', 'string', array('length' => 8));
34
        $table->addColumn('object_class', 'string', array('length' => 255));
35
        $table->addColumn('field', 'string', array('length' => 32));
36
        $table->setPrimaryKey(array('id'));
37
        $table->addIndex(
38
            array('locale', 'object_class', 'field', 'foreign_key'),
39
            'call_direction_translation_idx',
40
            array()
41
        );
42
        /** End of generate table orocrm_call_direction_trans **/
43
    }
44
45
    /**
46
     * Generate table orocrm_call_status_trans
47
     *
48
     * @param Schema $schema
49
     */
50 View Code Duplication
    public static function createCallStatusTranslationTable(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...
51
    {
52
        /** Generate table orocrm_call_status_trans **/
53
        $table = $schema->createTable('orocrm_call_status_trans');
54
        $table->addColumn('id', 'integer', array('autoincrement' => true));
55
        $table->addColumn('foreign_key', 'string', array('length' => 32));
56
        $table->addColumn('content', 'string', array('length' => 255));
57
        $table->addColumn('locale', 'string', array('length' => 8));
58
        $table->addColumn('object_class', 'string', array('length' => 255));
59
        $table->addColumn('field', 'string', array('length' => 32));
60
        $table->setPrimaryKey(array('id'));
61
        $table->addIndex(
62
            array('locale', 'object_class', 'field', 'foreign_key'),
63
            'call_status_translation_idx',
64
            array()
65
        );
66
        /** End of generate table orocrm_call_status_trans **/
67
    }
68
}
69