SinglePrice   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 2
c 1
b 0
f 0
dl 0
loc 10
ccs 0
cts 3
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A showPrice() 0 3 2
1
<?php
2
/**
3
 * Server module for HiPanel
4
 *
5
 * @link      https://github.com/hiqdev/hipanel-module-server
6
 * @package   hipanel-module-server
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel\modules\server\helpers\consumptionPriceFormatter;
12
13
use hipanel\modules\server\models\Consumption;
14
use Yii;
15
16
class SinglePrice implements PriceFormatterStrategy
17
{
18
    /**
19
     * @param Consumption $consumption
20
     * @throws \yii\base\InvalidConfigException
21
     * @return string
22
     */
23
    public function showPrice(Consumption $consumption): string
24
    {
25
        return $consumption->price ? Yii::$app->formatter->asCurrency($consumption->price, $consumption->currency) : '';
0 ignored issues
show
Bug Best Practice introduced by
The property currency does not exist on hipanel\modules\server\models\Consumption. Since you implemented __get, consider adding a @property annotation.
Loading history...
Bug Best Practice introduced by
The property price does not exist on hipanel\modules\server\models\Consumption. Since you implemented __get, consider adding a @property annotation.
Loading history...
26
    }
27
}
28