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

PlanAttribute::rules()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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
}