These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
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\grid\presenters\price; |
||
12 | |||
13 | use hipanel\modules\finance\models\Price; |
||
14 | use Money\MoneyFormatter; |
||
15 | |||
16 | /** |
||
17 | * Class CertificatePricePresenter. |
||
18 | * |
||
19 | * @author Dmytro Naumenko <[email protected]> |
||
20 | */ |
||
21 | class CertificatePricePresenter extends PricePresenter |
||
22 | { |
||
23 | /** |
||
24 | * @var MoneyFormatter |
||
25 | */ |
||
26 | private $moneyFormatter; |
||
27 | |||
28 | public function __construct(MoneyFormatter $moneyFormatter) |
||
29 | { |
||
30 | $this->moneyFormatter = $moneyFormatter; |
||
31 | parent::__construct(); |
||
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) { |
||
0 ignored issues
–
show
|
|||
42 | $result[] = $this->moneyFormatter->format($amount); |
||
43 | } |
||
44 | |||
45 | return implode(' / ', $result); |
||
46 | } |
||
47 | } |
||
48 |
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.