From 5e6b67b9f8f68c89765c1542bd82c74afb8bc781 Mon Sep 17 00:00:00 2001 From: Steve Bauman Date: Tue, 23 Jul 2024 11:48:15 -0400 Subject: [PATCH] Revert comment change --- src/Classes/KeyGenerator.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Classes/KeyGenerator.php b/src/Classes/KeyGenerator.php index 918b3df..e172fda 100644 --- a/src/Classes/KeyGenerator.php +++ b/src/Classes/KeyGenerator.php @@ -21,9 +21,12 @@ public function __construct(Hashids $hashids) } /** - * Generate a unique and random URL key using the Hashids package. - * - * @return string + * Generate a unique and random URL key using the Hashids package. We start by + * predicting the unique ID that the ShortURL will have in the database. + * Then we can encode the ID to create a unique hash. On the very + * unlikely chance that a generated key collides with another + * key, we increment the ID and then attempt to create a new + * unique key again. */ public function generateRandom(): string {