Issues (213)

helpers/consumptionPriceFormatter/SinglePrice.php (2 issues)

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