Test Failed
Push — master ( 45bc78...882099 )
by Alexey
05:03
created

Category   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 2
Bugs 1 Features 1
Metric Value
dl 0
loc 39
rs 10
c 2
b 1
f 1
wmc 3
lcom 0
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A afterSave() 0 3 1
A afterDelete() 0 3 1
A relations() 0 12 1
1
<?php
2
/**
3
 * INJI
4
 *
5
 * @author Alexey Krupskiy <[email protected]>
6
 * @link http://inji.ru/
7
 * @copyright 2017 Alexey Krupskiy
8
 * @license https://github.com/injitools/Inji/blob/master/LICENSE
9
 */
10
11
namespace Ecommerce\Catalog;
12
class Category extends \Model {
13
    static $cols = [
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $cols.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
14
        'catalog_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'catalog'],
15
        'category_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'category'],
16
    ];
17
    static $labels = [
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $labels.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
18
        'category_id' => 'Раздел товаров'
19
    ];
20
    static $dataManagers = [
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $dataManagers.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
21
        'manager' => [
22
            'cols' => ['category_id']
23
        ]
24
    ];
25
    static $forms = [
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $forms.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
26
        'manager' => [
27
            'map' => [['category_id']]
28
        ]
29
    ];
30
31
    public function afterSave() {
32
        $this->catalog->calcItemsCount();
33
    }
34
    public function afterDelete() {
35
        $this->catalog->calcItemsCount();
36
    }
37
38
    static function relations() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
39
        return [
40
            'catalog' => [
41
                'col' => 'catalog_id',
42
                'model' => 'Ecommerce\Catalog',
43
            ],
44
            'category' => [
45
                'col' => 'category_id',
46
                'model' => 'Ecommerce\Category',
47
            ]
48
        ];
49
    }
50
}