Example #1
0
 /**
  * Calculates the probability to hit an existing value on a token generation.
  *
  * @return float
  */
 public function getInsertProbability()
 {
     $maxCount = $this->getMaxCount();
     $dbCount = OnlineShop_Framework_VoucherService_Token_List::getCountByLength($this->getFinalTokenLength(), $this->seriesId);
     if ($dbCount !== null && $maxCount >= 0) {
         return ((int) $dbCount + $this->configuration->getCount()) / $maxCount;
     }
     return 1.0;
 }