Completed
Push — master ( 871cd8...ab1e03 )
by Kirill
03:44
created

Currency::getYmlBody()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1.125

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 2
cts 4
cp 0.5
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1.125
1
<?php
2
namespace pastuhov\ymlcatalog\models;
3
4
class Currency extends BaseModel
5
{
6
    /**
7
     * @inheritdoc
8
     */
9
    public static $tag = 'currency';
10
11
    /**
12
     * @inheritdoc
13
     */
14
    public static $tagProperties = [
15
        'id',
16
        'rate',
17
        'plus',
18
    ];
19
20
    public $id;
21
    public $rate;
22
    public $plus;
23
24
    /**
25
     * @inheritdoc
26
     */
27 5
    public function rules()
28
    {
29
        return [
30
            [
31
                [
32 5
                    'id',
33 5
                    'rate',
34 5
                ],
35 5
                'required',
36 5
            ],
37
            [
38
                [
39 5
                    'rate',
40 5
                ],
41 5
                'string',
42 5
                'max' => 5,
43 5
            ],
44
            [
45
                [
46 5
                    'id',
47 5
                ],
48 5
                'string',
49 5
                'max' => 3,
50 5
            ],
51
            [
52
                [
53 5
                    'plus',
54 5
                ],
55 5
                'integer',
56 5
            ],
57
            [
58
                [
59 5
                    'id',
60 5
                ],
61 5
                'in',
62
                'range' => [
63 5
                    'RUR',
64 5
                    'RUB',
65 5
                    'UAH',
66 5
                    'BYR',
67 5
                    'KZT',
68 5
                    'USD',
69
                    'EUR'
70 5
                ],
71 5
            ],
72 5
        ];
73
    }
74
75
    /**
76
     * @inheritdoc
77
     */
78 5
    protected function getYmlBody()
79
    {
80 5
        return null;
81
    }
82
    
83
    /**
84
     * @return string
85
     */
86 5
    protected function getYmlEndTag()
87
    {
88 5
        return '';
89
    }
90
91
    /**
92
     * @return string
93
     */
94 5 View Code Duplication
    protected function getYmlStartTag()
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...
95
    {
96 5
        $string = '';
97 5
        if (static::$tag) {
98 5
            $string = '<' . static::$tag . $this->getYmlTagProperties() . ' />';
99 5
        }
100
101 5
        return $string;
102
    }
103
}
104