private function findNonExistingUserEmail($username = 'User')
{
$email = "{$username}@ez.no";
if ($this->checkUserExistenceByEmail($email)) {
return $email;
}
for ($i = 0; $i < 20; ++$i) {
$email = 'User#' . uniqid() . '@ez.no';
if (!$this->checkUserExistenceByEmail($email)) {
return $email;
}
}
throw new \Exception('Possible endless loop when attempting to find a new email for User.');
}