1 | <?php |
||
21 | * @author Dmytro Naumenko <[email protected]> |
||
22 | */ |
||
23 | class CertificatePricePresenter extends PricePresenter |
||
24 | { |
||
25 | protected MoneyFormatter $moneyFormatter; |
||
|
|||
26 | |||
27 | public function __construct(Formatter $formatter, User $user, MoneyFormatter $moneyFormatter) |
||
28 | { |
||
29 | parent::__construct($formatter, $user); |
||
30 | |||
31 | $this->moneyFormatter = $moneyFormatter; |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * @param \hipanel\modules\finance\models\CertificatePrice $price |
||
36 | * @return string |
||
37 | */ |
||
38 | public function renderPrice(Price $price): string |
||
39 | { |
||
40 | $result = []; |
||
41 | foreach ($price->sums as $period => $amount) { |
||
42 | $result[] = $this->moneyFormatter->format($amount); |
||
43 | } |
||
44 | |||
45 | return implode(' / ', $result); |
||
46 | } |
||
47 | } |
||
48 |