| @@ 121-134 (lines=14) @@ | ||
| 118 | * |
|
| 119 | * @return float |
|
| 120 | */ |
|
| 121 | private function totalPrice() |
|
| 122 | { |
|
| 123 | $price = $this->price; |
|
| 124 | ||
| 125 | if ($this->hasOptions()) { |
|
| 126 | foreach ($this->data['options'] as $item) { |
|
| 127 | if (array_key_exists('price', $item)) { |
|
| 128 | $price += $item['price']; |
|
| 129 | } |
|
| 130 | } |
|
| 131 | } |
|
| 132 | ||
| 133 | return $price; |
|
| 134 | } |
|
| 135 | ||
| 136 | /** |
|
| 137 | * Return the total of the item, with or without tax. |
|
| @@ 159-172 (lines=14) @@ | ||
| 156 | * |
|
| 157 | * @return float The weight, as a float |
|
| 158 | */ |
|
| 159 | public function weight() |
|
| 160 | { |
|
| 161 | $weight = $this->weight; |
|
| 162 | ||
| 163 | if ($this->hasOptions()) { |
|
| 164 | foreach ($this->data['options'] as $item) { |
|
| 165 | if (array_key_exists('weight', $item)) { |
|
| 166 | $weight += $item['weight']; |
|
| 167 | } |
|
| 168 | } |
|
| 169 | } |
|
| 170 | ||
| 171 | return $weight * $this->quantity; |
|
| 172 | } |
|
| 173 | ||
| 174 | /** |
|
| 175 | * Return the total of the item, with or without tax. |
|