function validRequired() { if ($this->productPrice <= 0) { throw new \InvalidArgumentException("product price field couldn't be zero. check yours input value : " . $this->productPrice); } if (!isset($this->productDeliveryInfo)) { throw new \InvalidArgumentException("you should contain ProductDeliveryInfo object."); } $this->productDeliveryInfo->validRequired(); foreach ($this->offerList as $offer) { if (is_object($offer) && $offer instanceof Offer) { $offer->validRequired(); } } foreach ($this->loyaltyList as $loyalty) { if (is_object($loyalty) && $loyalty instanceof Loyalty) { $loyalty->validRequired(); } } foreach ($this->shippingAddressList as $shippingAddress) { if (is_object($shippingAddress) && $shippingAddress instanceof ShippingAddress) { $shippingAddress->validRequiredToCheckout(); } } foreach ($this->monthlyInstallmentList as $monthlyInstallment) { if (is_object($monthlyInstallment) && $monthlyInstallment instanceof MonthlyInstallment) { $monthlyInstallment->validRequired(); } } }