Category::rules()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 9

Duplication

Lines 18
Ratio 100 %

Code Coverage

Tests 12
CRAP Score 1.037

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 18
loc 18
ccs 12
cts 18
cp 0.6667
rs 9.4285
cc 1
eloc 9
nc 1
nop 0
crap 1.037
1
<?php
2
namespace pastuhov\ymlcatalog\models;
3
4
/**
5
 * Class Category
6
 * @package pastuhov\ymlcatalog\models
7
 */
8
class Category extends BaseModel
9
{
10
    /**
11
     * @inheritdoc
12
     */
13
    public static $tag = 'category';
14
15
    /**
16
     * @inheritdoc
17
     */
18
    public static $tagProperties = [
19
        'id',
20
        'parentId',
21
    ];
22
23
    public $name;
24
    public $parentId;
25
    public $id;
26
27
    /**
28
     * @inheritdoc
29
     */
30 5 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...
31
    {
32
        return [
33
            [
34 5
                ['id', 'name'],
35 5
                'required',
36 5
            ],
37
            [
38 5
                ['name'],
39 5
                'string',
40 5
                'max' => 255,
41 5
            ],
42
            [
43 5
                ['id', 'parentId'],
44 5
                'integer',
45 5
            ],
46 5
        ];
47
    }
48
}
49