Completed
Push — master ( b87a46...8351d4 )
by Dmitry
04:00
created

PanelResourceDecorator   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 8
c 1
b 0
f 1
lcom 1
cbo 4
dl 0
loc 42
rs 10
ccs 0
cts 32
cp 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A displayTitle() 0 4 1
A displayValue() 0 4 1
A displayUnit() 0 4 1
A displayPrepaidAmount() 0 9 2
A getPrepaidQuantity() 0 4 1
A getOverusePrice() 0 4 1
A displayOverusePrice() 0 4 1
1
<?php
2
3
namespace hipanel\modules\finance\models\decorators\server;
4
5
use Yii;
6
7
class PanelResourceDecorator extends AbstractServerResourceDecorator
8
{
9
    public function displayTitle()
10
    {
11
        return Yii::t('hipanel/finance/tariff', 'Control panel');
12
    }
13
14
    public function displayValue()
15
    {
16
        return Yii::t('yii', '{nFormatted} GB', ['nFormatted' => $this->getPrepaidQuantity()]);
17
    }
18
19
    public function displayUnit()
20
    {
21
        return Yii::t('hipanel/finance/tariff', '{n} Gbit/s', ['n' => 1]);
22
    }
23
24
    public function displayPrepaidAmount()
25
    {
26
        $result = Yii::t('hipanel/finance/tariff', 'No panel / {hipanelLink}', ['hipanelLink' => 'HiPanel']); // todo: add faq link
27
        if ($this->resource->tariff->getResourceByType('isp5')->quantity > 0) {
28
            $result .= ' / ' . Yii::t('hipanel/finance/tariff', 'ISP manager');
29
        }
30
31
        return $result;
32
    }
33
34
    public function getPrepaidQuantity()
35
    {
36
        return 1;
37
    }
38
39
    public function getOverusePrice()
40
    {
41
        return null;
42
    }
43
44
    public function displayOverusePrice()
45
    {
46
        return null;
47
    }
48
}
49