Open B0Bka opened 6 years ago
` public function setOffers(array $offers = []) { $this->offers = [ 'all' => [], 'minPrice' => false ]; if(!empty($offers)) { $offer = current($offers); $offer = array_reduce($offers, function(Offer $offer, Offer $o) { if(($o->getPrice() < $offer->getPrice())) { $offer = $o; } return $offer; }, $offer);
$this->offers['all'] = $offers; $this->offers['minPrice'] = $offer; } return $this; }`
` public function setOffers(array $offers = []) { $this->offers = [ 'all' => [], 'minPrice' => false ]; if(!empty($offers)) { $offer = current($offers); $offer = array_reduce($offers, function(Offer $offer, Offer $o) { if(($o->getPrice() < $offer->getPrice())) { $offer = $o; } return $offer; }, $offer);