| @@ 113-126 (lines=14) @@ | ||
| 110 | * |
|
| 111 | * @return float |
|
| 112 | */ |
|
| 113 | private function totalPrice() |
|
| 114 | { |
|
| 115 | $price = $this->price; |
|
| 116 | ||
| 117 | if ($this->hasOptions()) { |
|
| 118 | foreach ($this->data['options'] as $item) { |
|
| 119 | if (array_key_exists('price', $item)) { |
|
| 120 | $price += $item['price']; |
|
| 121 | } |
|
| 122 | } |
|
| 123 | } |
|
| 124 | ||
| 125 | return $price; |
|
| 126 | } |
|
| 127 | ||
| 128 | /** |
|
| 129 | * Return the total of the item, with or without tax. |
|
| @@ 151-164 (lines=14) @@ | ||
| 148 | * |
|
| 149 | * @return float The weight, as a float |
|
| 150 | */ |
|
| 151 | public function weight() |
|
| 152 | { |
|
| 153 | $weight = $this->weight; |
|
| 154 | ||
| 155 | if ($this->hasOptions()) { |
|
| 156 | foreach ($this->data['options'] as $item) { |
|
| 157 | if (array_key_exists('weight', $item)) { |
|
| 158 | $weight += $item['weight']; |
|
| 159 | } |
|
| 160 | } |
|
| 161 | } |
|
| 162 | ||
| 163 | return (float) ($weight * $this->quantity); |
|
| 164 | } |
|
| 165 | ||
| 166 | /** |
|
| 167 | * Return the total of the item, with or without tax. |
|