/** * Checks whether the coupon's start date is valid * * @return bool */ protected function isStartDateValid() { $now = new \DateTime(); $couponStartDate = $this->coupon->getValidFrom(); if ($couponStartDate instanceof \DateTime) { return $now >= $couponStartDate; } return true; }
/** * Checks whether the coupon's start date is valid * * @param CouponInterface $coupon * * @return bool */ private function isStartDateValid(CouponInterface $coupon) : bool { $now = new \DateTime(); $couponStartDate = $coupon->getValidFrom(); if ($couponStartDate instanceof \DateTime) { return $now >= $couponStartDate; } return true; }