Completed
Push — master ( 4b3a6a...ccebfa )
by Dmitry
04:39
created

ResourcePriceWidget   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 22
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A run() 0 4 1
1
<?php
2
/**
3
 * Finance module for HiPanel
4
 *
5
 * @link      https://github.com/hiqdev/hipanel-module-finance
6
 * @package   hipanel-module-finance
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel\modules\finance\widgets;
12
13
use Money\Money;
14
use Money\MoneyFormatter;
15
use yii\base\Widget;
16
17
class ResourcePriceWidget extends Widget
18
{
19
    /**
20
     * @var Money
21
     */
22
    public $price;
23
    /**
24
     * @var MoneyFormatter
25
     */
26
    private $moneyFormatter;
27
28
    public function __construct(MoneyFormatter $moneyFormatter, $config = [])
29
    {
30
        parent::__construct($config);
31
        $this->moneyFormatter = $moneyFormatter;
32
    }
33
34
    public function run()
35
    {
36
        return $this->moneyFormatter->format($this->price);
37
    }
38
}
39