Completed
Push — master ( 51e7b9...4b0341 )
by Alexey
05:48
created

Value   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 42
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 42
loc 42
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A relations() 13 13 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
 * Delivery user info
5
 * @author Alexey Krupskiy <[email protected]>
6
 * @link http://inji.ru/
7
 * @copyright 2016 Alexey Krupskiy
8
 * @license https://github.com/injitools/cms-Inji/blob/master/LICENSE
9
 */
10
11
namespace Ecommerce\Delivery;
12
13 View Code Duplication
class Value extends \Model
14
{
15
    public static $cols = [
16
        //Основные параметры
17
        'delivery_save_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'save'],
18
        'delivery_field_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'field'],
19
        'value' => ['type' => 'text'],
20
        //Системные
21
        'date_create' => ['type' => 'dateTime'],
22
    ];
23
    public static $forms = [
24
        'manager' => [
25
            'map' => [
26
                ['cart_id', 'delivery_field_id', 'value']
27
            ]
28
        ]
29
    ];
30
    public static $dataManagers = [
31
        'manager' => [
32
            'cols' => [
33
                'cart_id',
34
                'delivery_field_id',
35
                'value'
36
            ]
37
        ]
38
    ];
39
40
    public static function relations()
41
    {
42
        return [
43
            'field' => [
44
                'model' => 'Ecommerce\Delivery\Field',
45
                'col' => 'useradds_field_id'
46
            ],
47
            'save' => [
48
                'model' => 'Ecommerce\Delivery\Save',
49
                'col' => 'cart_id'
50
            ],
51
        ];
52
    }
53
54
}
55