/** * @return array */ public function getStatistics($usagePeriod = null) { $overallCount = $this->configuration->getUsages(); $usageCount = OnlineShop_Framework_VoucherService_Token::getByCode($this->configuration->getToken())->getUsages(); $reservedTokenCount = OnlineShop_Framework_VoucherService_Token_List::getCountByReservation($this->seriesId); $usage = OnlineShop_Framework_VoucherService_Statistic::getBySeriesId($this->seriesId, $usagePeriod); $this->prepareUsageStatisticData($usage, $usagePeriod); return ['overallCount' => $overallCount, 'usageCount' => $usageCount, 'freeCount' => $overallCount - $usageCount - $reservedTokenCount, 'reservedCount' => $reservedTokenCount, 'usage' => $usage]; }
/** * @return array */ public function getStatistics($usagePeriod = null) { $overallCount = OnlineShop_Framework_VoucherService_Token_List::getCountBySeriesId($this->seriesId); $usageCount = OnlineShop_Framework_VoucherService_Token_List::getCountByUsages(1, $this->seriesId); $reservedTokenCount = OnlineShop_Framework_VoucherService_Token_List::getCountByReservation($this->seriesId); $usage = OnlineShop_Framework_VoucherService_Statistic::getBySeriesId($this->seriesId, $usagePeriod); if (is_array($usage)) { $this->prepareUsageStatisticData($usage, $usagePeriod); } return ['overallCount' => $overallCount, 'usageCount' => $usageCount, 'freeCount' => $overallCount - $usageCount - $reservedTokenCount, 'reservedCount' => $reservedTokenCount, 'usage' => $usage]; }