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