Completed
Push — master ( b14a13...f7bdb9 )
by Andrii
26:35 queued 11:41
created

OveruseServerPrice::isServer95Traf()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 1
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace hipanel\modules\finance\models;
4
5
use hipanel\base\ModelTrait;
6
use Yii;
7
8
class OveruseServerPrice extends Price
9
{
10
    use ModelTrait;
11
12
    public static function tableName()
13
    {
14
        return 'price';
15
    }
16
17
    /**
18
     * @return array
19
     */
20
    public function rules(): array
21
    {
22
        $rules = parent::rules();
23
        $rules[] = [['count_aggregated_traffic'], 'boolean', 'trueValue' => 1, 'falseValue' => 0];
24
25
        return $rules;
26
    }
27
28
    /**
29
     * @return array
30
     */
31
    public function attributeLabels(): array
32
    {
33
        return array_merge(parent::attributeLabels(), [
34
            'count_aggregated_traffic' => Yii::t('hipanel.finance.price', 'Calculate aggregated traffic'),
35
        ]);
36
    }
37
38
    /** {@inheritdoc} */
39
    public function isServer95Traf()
40
    {
41
        return strpos($this->type, 'overuse,server_traf95_max') === 0;
42
    }
43
44
}
45