public function generateIndividualCodes(string
$pattern, int
$amount, array
$codeBlacklist =
[]): array
{ if ($amount < 1
) { return [];
} $codePattern =
$this->
splitPattern($pattern);
$blacklistCount = \
count($codeBlacklist);
/*
* This condition ensures a fundamental randomness to the generated codes in ratio to all possibilities, which
* also minimizes the number of retries. Therefore, the CODE_COMPLEXITY_FACTOR is the worst-case-scenario
* probability to find a new unique promotion code.
*/
$complexity =
$this->
isComplexEnough($codePattern['replacementString'
],
$amount,
$blacklistCount);
if (!
$complexity) {