DeliveryOption::getYmlBody()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
namespace pastuhov\ymlcatalog\models;
3
4
/**
5
 * Class DeliveryOption
6
 *
7
 * Модель опции условий доставки - тега option в секции delivery-option
8
 * @package pastuhov\ymlcatalog\models
9
 */
10
class DeliveryOption extends BaseModel
11
{
12
    /**
13
     * @inheritdoc
14
     */
15
    public static $tag = 'option';
16
17
    /**
18
     * @inheritdoc
19
     */
20
    public static $tagProperties = [
21
        'cost',
22
        'days',
23
        'orderBefore' => 'order-before'
24
    ];
25
26
    /** @var int Стоимость доставки в рублях. */
27
    public $cost;
28
29
    /** @var string Срок доставки в рабочих днях. */
30
    public $days;
31
32
    /** @var int Время, до которого нужно сделать заказ, чтобы получить его в этот срок. */
33
    public $orderBefore;
34 4
35
    /**
36
     * @inheritdoc
37
     */
38 4 View Code Duplication
    public function rules()
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...
39 4
    {
40 4
        return [
41
            [
42 4
                ['cost', 'days'],
43 4
                'required',
44 4
            ],
45
            [
46 4
                ['cost', 'orderBefore'],
47 4
                'integer',
48 4
            ],
49 4
            [
50 4
                ['days'],
51
                'string',
52
                'max' => 5,
53
            ],
54
        ];
55
    }
56 4
57
    /**
58 4
     * @inheritdoc
59
     */
60
    protected function getYmlBody()
61
    {
62
        return null;
63
    }
64 4
65
    /**
66 4
     * @return string
67
     */
68
    protected function getYmlStartTag()
69
    {
70
        return str_replace('>', ' />', parent::getYmlStartTag());
71
    }
72 4
73
    /**
74 4
     * @return string
75
     */
76
    protected function getYmlEndTag()
77
    {
78
        return '';
79
    }
80
}
81