diff --git a/4dev/tests/Create/CoreLibsCreateRandomKeyTest.php b/4dev/tests/Create/CoreLibsCreateRandomKeyTest.php index e2714008..353ec25b 100644 --- a/4dev/tests/Create/CoreLibsCreateRandomKeyTest.php +++ b/4dev/tests/Create/CoreLibsCreateRandomKeyTest.php @@ -64,12 +64,19 @@ final class CoreLibsCreateRandomKeyTest extends TestCase } // Alternative more efficient version using strpos - private function allCharsInSet(string $input, string $allowedChars): bool + /** + * check if all characters are in set + * + * @param string $input + * @param string $allowed_chars + * @return bool + */ + private function allCharsInSet(string $input, string $allowed_chars): bool { $inputLength = strlen($input); for ($i = 0; $i < $inputLength; $i++) { - if (strpos($allowedChars, $input[$i]) === false) { + if (strpos($allowed_chars, $input[$i]) === false) { return false; } } diff --git a/www/lib/CoreLibs/Create/RandomKey.php b/www/lib/CoreLibs/Create/RandomKey.php index 116e1c21..59943ce2 100644 --- a/www/lib/CoreLibs/Create/RandomKey.php +++ b/www/lib/CoreLibs/Create/RandomKey.php @@ -30,6 +30,8 @@ class RandomKey /** * if launched as class, init random key data first + * + * @param array ...$key_range */ public function __construct(array ...$key_range) { @@ -39,7 +41,7 @@ class RandomKey /** * internal key range validation * - * @param array> ...$key_range + * @param array ...$key_range * @return string */ private static function validateRandomKeyData(array ...$key_range): string @@ -54,7 +56,7 @@ class RandomKey /** * sets the random key range with the default values * - * @param array> $key_range a list of key ranges as array + * @param array $key_range a list of key ranges as array * @return void has no return * @throws \LengthException If the string length is only 1 abort */ @@ -150,11 +152,11 @@ class RandomKey * if override key length is set, it will check on valid key and use this * this will not set the class key length variable * - * @param int $key_length [default=-1] key length override, - * if not set use default [LEGACY] - * @param array> $key_range a list of key ranges as array, - * if not set use previous set data - * @return string random key + * @param int $key_length [default=-1] key length override, + * if not set use default [LEGACY] + * @param array $key_range a list of key ranges as array, + * if not set use previous set data + * @return string random key */ public static function randomKeyGen( int $key_length = self::KEY_LENGTH_DEFAULT,