コード例 #1
0
ファイル: VoucherValidator.php プロジェクト: spryker/Discount
 /**
  * @param \Orm\Zed\Discount\Persistence\SpyDiscountVoucher $discountVoucherEntity
  *
  * @return bool
  */
 protected function isValidNumberOfUses(SpyDiscountVoucher $discountVoucherEntity)
 {
     if ($discountVoucherEntity->getMaxNumberOfUses() > 0 && $discountVoucherEntity->getNumberOfUses() >= $discountVoucherEntity->getMaxNumberOfUses()) {
         return false;
     }
     return true;
 }
コード例 #2
0
ファイル: VoucherCode.php プロジェクト: spryker/Discount
 /**
  * @param \Orm\Zed\Discount\Persistence\SpyDiscountVoucher $discountVoucherEntity
  *
  * @return void
  */
 protected function decrementNumberOfUses(SpyDiscountVoucher $discountVoucherEntity)
 {
     $numberOfUses = $discountVoucherEntity->getNumberOfUses();
     $discountVoucherEntity->setNumberOfUses(--$numberOfUses);
 }