Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
storewithproductsinfo.php
1<?php
2
4
6
8{
9 protected array $productList = [];
10
15 public function getProductList(): array
16 {
17 return $this->productList;
18 }
19
25 public function addProduct(ProductInfo ...$product): void
26 {
27 array_push($this->productList, ...$product);
28 }
29
34 public function getCalculatedSumPrice(): float
35 {
36 $sum = 0.0;
37
39 foreach ($this->getProductList() as $product)
40 {
41 $sum += $product->getPrice() * $product->getQuantity();
42 }
43
44 return $sum;
45 }
46}