コード例 #1
0
ファイル: Token.php プロジェクト: ascertain/NGshop
 /**
  * @param null|int $maxUsages
  * @param bool $isCheckout In the checkout there is one reservation more, the one of the current order.
  * @return bool
  */
 public function check($maxUsages = null, $isCheckout = false)
 {
     if (isset($maxUsages)) {
         if ($this->getUsages() + OnlineShop_Framework_VoucherService_Reservation::getReservationCount($this->getToken()) - (int) $isCheckout < $maxUsages) {
             return true;
         }
         return false;
     } else {
         return !$this->isUsed() && !$this->isReserved();
     }
 }