= self::DISCRETE_VALUES) { self::$counter = 0; } return self::$counter; } private static function getRandomBlock(): string { $rand = floor(mt_rand() / mt_getrandmax() * self::DISCRETE_VALUES); return self::pad((string) $rand, self::BLOCK_SIZE); } private static function getCounterBlock(): string { return self::pad((string) self::next(), self::BLOCK_SIZE); } private static function getTimestampBlock(): string { return self::pad((string) floor(microtime(true) * 1000), self::BLOCK_SIZE * 2); } private static function getHostnameSubBlock(): string { $sum = strlen(gethostname()) + self::BASE36; foreach (str_split(gethostname()) as $char) { $sum += ord($char); } return self::pad((string) $sum, self::BLOCK_SIZE / 2); } private static function getPidSubBlock(): string { return self::pad((string) getmypid(), self::BLOCK_SIZE / 2); } private static function getFingerprintBlock(): string { return self::getPidSubBlock().self::getHostnameSubBlock(); } }