private function isActive(CouponInterface $coupon, \DateTime $now = null)
    {
        if (!$coupon->isEnabled()) {
            return false;
        }

        $now = $now ?: $this
            ->dateTimeFactory
            ->create();

        if ($coupon->getValidFrom() > $now) {
            return false;
        }

        $validTo = $coupon->getValidTo();
        if ($validTo && $now > $validTo) {
            return false;
        }

        return true;
    }
private function isActive(CouponInterface $coupon, \DateTime $now = null)
    {
        if (!$coupon->isEnabled()) {
            return false;
        }

        $now = $now ?: $this
            ->dateTimeFactory
            ->create();

        if ($coupon->getValidFrom() > $now) {
            return false;
        }

        $validTo = $coupon->getValidTo();
        if ($validTo && $now > $validTo) {
            return false;
        }

        return true;
    }
private function isActive ( CouponInterface $ coupon , \ DateTime $ now = null ) { if ( ! $ coupon -> isEnabled ( ) ) { return false ; } $ now = $ now ? : $ this -> dateTimeFactory -> create ( ) ; if ( $ coupon -> getValidFrom ( ) > $ now ) { return false ; } $ validTo = $ coupon -> getValidTo ( ) ; if ( $ validTo && $ now > $ validTo ) { return false ; } return true ; }
Check if a coupon is currently active.

@param CouponInterface $coupon Coupon to check activeness
@param DateTime        $now

@return bool
Check if a coupon is currently active .