当前位置: 首页>>代码示例>>PHP>>正文


PHP PromotionInterface::getStartsAt方法代码示例

本文整理汇总了PHP中Sylius\Component\Promotion\Model\PromotionInterface::getStartsAt方法的典型用法代码示例。如果您正苦于以下问题:PHP PromotionInterface::getStartsAt方法的具体用法?PHP PromotionInterface::getStartsAt怎么用?PHP PromotionInterface::getStartsAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sylius\Component\Promotion\Model\PromotionInterface的用法示例。


在下文中一共展示了PromotionInterface::getStartsAt方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isEligible

 /**
  * {@inheritdoc}
  */
 public function isEligible(PromotionSubjectInterface $promotionSubject, PromotionInterface $promotion)
 {
     $now = new \DateTime();
     $startsAt = $promotion->getStartsAt();
     if (null !== $startsAt && $now < $startsAt) {
         return false;
     }
     $endsAt = $promotion->getEndsAt();
     if (null !== $endsAt && $now > $endsAt) {
         return false;
     }
     return true;
 }
开发者ID:loic425,项目名称:Sylius,代码行数:16,代码来源:PromotionDurationEligibilityChecker.php

示例2:

 function it_recognizes_subject_as_eligible_if_coupon_code_match($dispatcher, PromotionCouponsAwareSubjectInterface $subject, PromotionInterface $promotion, CouponInterface $coupon)
 {
     $subject->getPromotionCoupons()->willReturn(array($coupon));
     $promotion->getStartsAt()->willReturn(null);
     $promotion->getEndsAt()->willReturn(null);
     $promotion->getUsageLimit()->willReturn(null);
     $promotion->hasRules()->willReturn(false);
     $promotion->isCouponBased()->willReturn(true);
     $coupon->getPromotion()->willReturn($promotion);
     $dispatcher->dispatch(SyliusPromotionEvents::COUPON_ELIGIBLE, Argument::any())->shouldBeCalled();
     $this->isEligible($subject, $promotion)->shouldReturn(true);
 }
开发者ID:gaetzone,项目名称:Sylius,代码行数:12,代码来源:PromotionEligibilityCheckerSpec.php

示例3: isEligibleToDates

 /**
  * Checks if the current is between promotion limits.
  *
  * @param PromotionInterface $promotion
  *
  * @return bool
  */
 protected function isEligibleToDates(PromotionInterface $promotion)
 {
     $now = new \DateTime();
     if (null !== ($startsAt = $promotion->getStartsAt())) {
         if ($now < $startsAt) {
             return false;
         }
     }
     if (null !== ($endsAt = $promotion->getEndsAt())) {
         if ($now > $endsAt) {
             return false;
         }
     }
     return true;
 }
开发者ID:Mangetsu,项目名称:Sylius,代码行数:22,代码来源:PromotionEligibilityChecker.php

示例4:

 function it_returns_true_if_promotion_dates_are_not_specified(PromotionSubjectInterface $promotionSubject, PromotionInterface $promotion)
 {
     $promotion->getStartsAt()->willReturn(null);
     $promotion->getEndsAt()->willReturn(null);
     $this->isEligible($promotionSubject, $promotion)->shouldReturn(true);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:6,代码来源:DatesEligibilityCheckerSpec.php


注:本文中的Sylius\Component\Promotion\Model\PromotionInterface::getStartsAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。