Completed
Pull Request — master (#51)
by
unknown
16:03 queued 01:06
created

ParamOffer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A rules() 0 13 1
A getYmlBody() 0 4 1
1
<?php
2
3
namespace pastuhov\ymlcatalog\models;
4
5
/**
6
 * Class DeliveryOption
7
 * Модель опции условий доставки - тега option в секции delivery-option
8
 *
9
 * @package pastuhov\ymlcatalog\models
10
 */
11
class ParamOffer extends BaseModel
12
{
13
    /**
14
     * @inheritdoc
15
     */
16
    public static $tag = 'param';
17
18
    /**
19
     * @inheritdoc
20
     */
21
    public static $tagProperties = [
22
        'name',
23
        'unit',
24
    ];
25
26
    /** @var string Название параметра. */
27
    public $name;
28
29
    /** @var string Единицы измерения. */
30
    public $unit;
31
32
    /** @var string Значение параметра. */
33
    public $value;
34
35
    /**
36
     * @inheritdoc
37
     */
38
    public function rules()
39
    {
40
        return [
41
            [
42
                ['name', 'value'],
43
                'required',
44
            ],
45
            [
46
                ['name', 'value', 'unit'],
47
                'string',
48
            ],
49
        ];
50
    }
51
52
    protected function getYmlBody()
53
    {
54
        return $this->value;
55
    }
56
}
57