1 | <?php namespace Darryldecode\Cart; |
||
13 | class ItemCollection extends Collection { |
||
14 | |||
15 | /** |
||
16 | * Sets the config parameters. |
||
17 | * |
||
18 | * @var |
||
19 | */ |
||
20 | protected $config; |
||
21 | |||
22 | /** |
||
23 | * ItemCollection constructor. |
||
24 | * @param array|mixed $items |
||
25 | * @param $config |
||
26 | */ |
||
27 | public function __construct($items, $config) |
||
33 | |||
34 | /** |
||
35 | * get the sum of price |
||
36 | * |
||
37 | * @return mixed|null |
||
38 | */ |
||
39 | public function getPriceSum($formatted = true) |
||
40 | { |
||
41 | return Helpers::formatValue($this->price * $this->quantity, $formatted, $this->config); |
||
42 | |||
43 | } |
||
44 | |||
45 | public function __get($name) |
||
50 | |||
51 | /** |
||
52 | * check if item has conditions |
||
53 | * |
||
54 | * @return bool |
||
55 | */ |
||
56 | public function hasConditions() |
||
68 | |||
69 | /** |
||
70 | * check if item has conditions |
||
71 | * |
||
72 | * @return mixed|null |
||
73 | */ |
||
74 | public function getConditions() |
||
79 | |||
80 | /** |
||
81 | * get the single price in which conditions are already applied |
||
82 | * @param bool $formatted |
||
83 | * @return mixed|null |
||
84 | */ |
||
85 | public function getPriceWithConditions($formatted = true) |
||
111 | |||
112 | /** |
||
113 | * get the sum of price in which conditions are already applied |
||
114 | * @param bool $formatted |
||
115 | * @return mixed|null |
||
116 | */ |
||
117 | public function getPriceSumWithConditions($formatted = true) |
||
121 | |||
122 | /** |
||
123 | * get the sum of condition type |
||
124 | * @param string $type |
||
125 | * @param bool $multiple |
||
126 | * @param bool $formatted |
||
127 | * @return mixed|null |
||
128 | */ |
||
129 | public function getPriceOfCondition($type, $multiple = true, $formatted = true) |
||
152 | } |
||
153 |
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.