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

Shop::getYmlBody()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2.0625

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
ccs 6
cts 8
cp 0.75
rs 9.4285
cc 2
eloc 5
nc 2
nop 0
crap 2.0625
1
<?php
2
namespace pastuhov\ymlcatalog\models;
3
4
class Shop extends BaseModel
5
{
6
    /**
7
     * @inheritdoc
8
     */
9
    public static $tag = false;
10
11
    public $name;
12
    public $company;
13
    public $url;
14
    public $platform;
15
    public $version;
16
    public $agency;
17
    public $email;
18
    public $cpa;
19
20
    /**
21
     * @inheritdoc
22
     */
23 5
    public function rules()
24
    {
25
        return [
26
            [
27 5
                ['name', 'company', 'url'],
28 5
                'required',
29 5
            ],
30
            [
31 5
                ['name'],
32 5
                'string',
33 5
                'max' => 20,
34 5
            ],
35
            [
36 5
                ['company', 'url', 'platform', 'version', 'agency', 'email'],
37 5
                'string',
38 5
                'max' => 255,
39 5
            ],
40
            [
41 5
                ['email'],
42 5
                'email',
43 5
            ],
44
            [
45 5
                ['cpa'],
46 5
                'boolean',
47 5
            ],
48 5
        ];
49
    }
50
51
    /**
52
     * @inheritdoc
53
     */
54 5
    protected function getYmlBody()
55
    {
56 5
        $string = '';
57
58 5
        foreach ($this->getYmlAttributes() as $attribute) {
59 5
            $string .= $this->getYmlAttribute($attribute);
60 5
        }
61
62 5
        return $string;
63
    }
64
}
65