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

Shop   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 71.43%

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 3
c 3
b 0
f 1
lcom 0
cbo 1
dl 0
loc 61
ccs 25
cts 35
cp 0.7143
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
B rules() 0 27 1
A getYmlBody() 0 10 2
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