Completed
Push — master ( 8d2b6e...df3805 )
by Andrii
13:34
created

PlanAttribute   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 25
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A rules() 0 7 1
A isEmpty() 0 4 2
A attributeLabels() 0 7 1
1
<?php
2
3
namespace hipanel\modules\finance\models;
4
5
use hipanel\base\Model;
6
use hipanel\base\ModelTrait;
7
use Yii;
8
9
/**
10
 * @property string|null name
11
 * @property string|null value
12
 */
13
class PlanAttribute extends Model
14
{
15
    use ModelTrait;
16
17
    public function rules()
18
    {
19
        return [
20
            [['name', 'value'], 'string'],
21
            [['name', 'value'], 'trim'],
22
        ];
23
    }
24
25
    public function isEmpty(): bool
26
    {
27
        return empty($this->name) || empty($this->value);
28
    }
29
30
    public function attributeLabels()
31
    {
32
        return [
33
            'name' => Yii::t('hipanel:finance', 'Name'),
34
            'value' => Yii::t('hipanel:finance', 'Value'),
35
        ];
36
    }
37
}