1 | <?php |
||
14 | final class QuantityFormatterFactory implements QuantityFormatterFactoryInterface |
||
15 | { |
||
16 | /** |
||
17 | * @var array maps bill type to a QuantityFormatter |
||
18 | * // TODO: use DI to configure |
||
19 | */ |
||
20 | protected $types = [ |
||
21 | 'support_time' => SupportTimeQuantity::class, |
||
22 | 'server_traf_max' => DefaultQuantityFormatter::class, |
||
23 | 'server_traf95_max' => DefaultQuantityFormatter::class, |
||
24 | 'backup_du' => DefaultQuantityFormatter::class, |
||
25 | 'server_du' => DefaultQuantityFormatter::class, |
||
26 | 'hw_purchase' => DefaultQuantityFormatter::class, |
||
27 | 'ip_num' => IPNumQuantity::class, |
||
28 | 'monthly' => MonthlyQuantity::class, |
||
29 | 'drenewal' => DomainRenewalQuantity::class, |
||
30 | ]; |
||
31 | /** |
||
32 | * @var IntlFormatter |
||
33 | */ |
||
34 | private $intlFormatter; |
||
35 | |||
36 | public function __construct(IntlFormatter $intlFormatter) |
||
40 | |||
41 | /** {@inheritdoc} */ |
||
42 | public function create($model): ?QuantityFormatterInterface |
||
54 | |||
55 | /** |
||
56 | * @param Bill|BillForm $bill |
||
57 | * @return QuantityFormatterInterface|null |
||
58 | */ |
||
59 | public function forBill($bill): ?QuantityFormatterInterface |
||
63 | |||
64 | public function forCharge(Charge $charge): ?QuantityFormatterInterface |
||
68 | |||
69 | /** {@inheritdoc} */ |
||
70 | public function createByType(string $type, Quantity $quantity, $context = null): ?QuantityFormatterInterface |
||
86 | |||
87 | private function fixType($type): string |
||
96 | } |
||
97 |
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.