Completed
Pull Request — master (#15)
by
unknown
03:10
created

DeliveryOption   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 51
Duplicated Lines 94.12 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A rules() 18 18 1
A getYmlBody() 2 4 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
namespace pastuhov\ymlcatalog\models;
3
4
/**
5
 * Class DeliveryOption
6
 *
7
 * Модель опции условий доставки - тега option в секции delivery-option
8
 * @package pastuhov\ymlcatalog\models
9
 */
10 View Code Duplication
class DeliveryOption extends BaseModel
0 ignored issues
show
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
     * @inheritdoc
14
     */
15
    public static $tag = 'option';
16
17
    /**
18
     * @inheritdoc
19
     */
20
    public static $tagProperties = [
21
        'cost',
22
        'days',
23
    ];
24
25
    /** @var int Стоимость доставки в рублях. */
26
    public $cost;
27
28
    /** @var string Срок доставки в рабочих днях. */
29
    public $days;
30
31
    /**
32
     * @inheritdoc
33
     */
34
    public function rules()
35
    {
36
        return [
37
            [
38
                ['cost', 'days'],
39
                'required',
40
            ],
41
            [
42
                ['cost'],
43
                'integer',
44
            ],
45
            [
46
                ['days'],
47
                'string',
48
                'max' => 5,
49
            ],
50
        ];
51
    }
52
53
    /**
54
     * @inheritdoc
55
     */
56
    protected function getYmlBody()
57
    {
58
        return null;
59
    }
60
}
61