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

DeliveryFieldLink   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 38
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 38
loc 38
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
 * Link between delivery and link
5
 *
6
 * @author Alexey Krupskiy <[email protected]>
7
 * @link http://inji.ru/
8
 * @copyright 2016 Alexey Krupskiy
9
 * @license https://github.com/injitools/cms-Inji/blob/master/LICENSE
10
 */
11
12
namespace Ecommerce\Delivery;
13
14 View Code Duplication
class DeliveryFieldLink extends \Model
15
{
16
    static $cols = [
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $cols.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
17
        'delivery_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'delivery'],
18
        'delivery_field_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'field'],
19
        'weight' => ['type' => 'number'],
20
        'date_create' => ['type' => 'dateTime']
21
    ];
22
    static $dataManagers = [
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $dataManagers.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
23
        'manager' => [
24
            'name' => 'Поля для доставки',
25
            'cols' => ['delivery_id', 'delivery_field_id', 'date_create'],
26
            //'sortMode' => true
27
        ]
28
    ];
29
    static $forms = [
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $forms.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
30
        'manager' => [
31
            'map' => [
32
                ['delivery_id', 'delivery_field_id'],
33
            ]
34
        ]
35
    ];
36
37
    static function relations()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
38
    {
39
        return [
40
            'field' => [
41
                'model' => 'Ecommerce\Delivery\Field',
42
                'col' => 'delivery_field_id'
43
            ],
44
            'delivery' => [
45
                'model' => 'Ecommerce\Delivery',
46
                'col' => 'delivery_id'
47
            ],
48
        ];
49
    }
50
51
}
52