@@ -237,13 +237,13 @@ class Sqids implements SqidsInterface
237237
238238 protected MathInterface $ math ;
239239
240- protected ?string $ blocklist = null ;
240+ protected ?string $ blocklistRegex = null ;
241241
242- /** @throws \ InvalidArgumentException */
242+ /** @throws InvalidArgumentException */
243243 public function __construct (
244244 protected string $ alphabet = self ::DEFAULT_ALPHABET ,
245245 protected int $ minLength = self ::DEFAULT_MIN_LENGTH ,
246- array $ blocklist = self ::DEFAULT_BLOCKLIST ,
246+ protected array $ blocklist = self ::DEFAULT_BLOCKLIST ,
247247 ) {
248248 $ this ->math = $ this ->getMathExtension ();
249249
@@ -270,15 +270,14 @@ public function __construct(
270270 );
271271 }
272272
273- // Filter out blocklist words that are shorter than 3 characters or contain non-alphabet characters
274273 $ filteredBlocklist = [];
275274 foreach ($ blocklist as $ word ) {
276275 if (strlen ((string ) $ word ) >= 3 ) {
277276 $ filteredBlocklist [] = strtr (preg_quote ((string ) $ word , '/ ' ), self ::LEET );
278277 }
279278 }
280279 if ($ filteredBlocklist ) {
281- $ this ->blocklist = '/( ' . implode ('| ' , $ filteredBlocklist ) . ')/i ' ;
280+ $ this ->blocklistRegex = '/( ' . implode ('| ' , $ filteredBlocklist ) . ')/i ' ;
282281 }
283282
284283 $ this ->alphabet = $ this ->shuffle ($ alphabet );
@@ -448,7 +447,7 @@ protected function toNumber(string $id, string $alphabet): int
448447
449448 protected function isBlockedId (string $ id ): bool
450449 {
451- return $ this ->blocklist !== null && preg_match ($ this ->blocklist , $ id );
450+ return $ this ->blocklistRegex !== null && preg_match ($ this ->blocklistRegex , $ id );
452451 }
453452
454453 protected static function maxValue (): int
0 commit comments