Test Failed
Push — master ( 23cc6e...476483 )
by Alexey
05:28
created

Item   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 43
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 43
loc 43
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A name() 3 3 1
A relations() 8 8 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
/**
4
 * Item option item
5
 *
6
 * @author Alexey Krupskiy <[email protected]>
7
 * @link http://inji.ru/
8
 * @copyright 2015 Alexey Krupskiy
9
 * @license https://github.com/injitools/cms-Inji/blob/master/LICENSE
10
 */
11
12
namespace Ecommerce\UserAdds\Field;
13
14 View Code Duplication
class Item extends \Model {
15
16
    public static $objectName = 'Элемент коллекции поля формы';
17
    public static $cols = [
18
        //Основные параметры
19
        'useradds_field_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'field'],
20
        'value' => ['type' => 'text'],
21
        'data' => ['type' => 'textarea'],
22
        //Системные
23
        'weight' => ['type' => 'number'],
24
        'date_create' => ['type' => 'dateTime']
25
    ];
26
    public static $labels = [
27
        'value' => 'Значение',
28
        'data' => 'Дополнительные данные',
29
    ];
30
    public static $dataManagers = [
31
        'manager' => [
32
            'cols' => ['value', 'data', 'date_create']
33
        ]
34
    ];
35
    public static $forms = [
36
        'manager' => [
37
            'map' => [
38
                ['value', 'data']
39
            ]
40
        ]
41
    ];
42
43
    public function name() {
44
        return $this->value;
45
    }
46
47
    public static function relations() {
48
        return [
49
            'field' => [
50
                'model' => 'Ecommerce\Delivery\Field',
51
                'col' => 'useradds_field_id'
52
            ]
53
        ];
54
    }
55
56
}
57