Completed
Pull Request — master (#6)
by
unknown
04:50
created

Shop::getYmlBody()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
ccs 0
cts 8
cp 0
rs 9.4285
cc 2
eloc 5
nc 2
nop 0
crap 6
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 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...
24
    {
25
        return [
26
            [
27
                ['name', 'company', 'url'],
28
                'required',
29
            ],
30
            [
31
                ['name'],
32
                'string',
33
                'max' => 20,
34
            ],
35
            [
36
                ['company', 'url', 'platform', 'version', 'agency', 'email'],
37
                'string',
38
                'max' => 255,
39
            ],
40
            [
41
                ['email'],
42
                'email',
43
            ],
44
            [
45
                ['cpa'],
46
                'in',
47
                'range' => ['1', '2'],
48
            ],
49
        ];
50
    }
51
52
    /**
53
     * @inheritdoc
54
     */
55
    protected function getYmlBody()
56
    {
57
        $string = '';
58
59
        foreach ($this->getYmlAttributes() as $attribute) {
60
            $string .= $this->getYmlAttribute($attribute);
61
        }
62
63
        return $string;
64
    }
65
}
66