diff --git a/phpstan.neon b/phpstan.neon
index c9f147be..d5448c07 100644
--- a/phpstan.neon
+++ b/phpstan.neon
@@ -4,6 +4,7 @@ includes:
parameters:
tmpDir: /tmp/phpstan-corelibs
level: 8 # max is now 9
+ checkMissingCallableSignature: true
paths:
- %currentWorkingDirectory%/www
bootstrapFiles:
diff --git a/www/admin/class_test.randomkey.php b/www/admin/class_test.randomkey.php
index de335b20..c91ffcd4 100644
--- a/www/admin/class_test.randomkey.php
+++ b/www/admin/class_test.randomkey.php
@@ -50,11 +50,13 @@ print '
';
$key_length = 10;
$key_length_b = 5;
+$key_lenght_long = 64;
print "S::RANDOMKEYGEN(auto): " . RandomKey::randomKeyGen() . "
";
print "S::SETRANDOMKEYLENGTH($key_length): " . RandomKey::setRandomKeyLength($key_length) . "
";
print "S::RANDOMKEYGEN($key_length): " . RandomKey::randomKeyGen() . "
";
print "S::RANDOMKEYGEN($key_length_b): " . RandomKey::randomKeyGen($key_length_b) . "
";
print "S::RANDOMKEYGEN($key_length): " . RandomKey::randomKeyGen() . "
";
+print "S::RANDOMKEYGEN($key_lenght_long): " . RandomKey::randomKeyGen($key_lenght_long) . "
";
$_array = new CoreLibs\Create\RandomKey();
print "C->RANDOMKEYGEN(auto): " . $_array->randomKeyGen() . "
";
// DEPRECATED
diff --git a/www/lib/CoreLibs/Convert/Colors.php b/www/lib/CoreLibs/Convert/Colors.php
index f565ebda..7e519357 100644
--- a/www/lib/CoreLibs/Convert/Colors.php
+++ b/www/lib/CoreLibs/Convert/Colors.php
@@ -10,6 +10,9 @@
* hsl to rgb
*/
+// TODO: use oklab as base for converting colors
+// https://bottosson.github.io/posts/oklab/
+
declare(strict_types=1);
namespace CoreLibs\Convert;
diff --git a/www/lib/CoreLibs/Create/RandomKey.php b/www/lib/CoreLibs/Create/RandomKey.php
index 80c476c7..e3c7aa32 100644
--- a/www/lib/CoreLibs/Create/RandomKey.php
+++ b/www/lib/CoreLibs/Create/RandomKey.php
@@ -11,8 +11,8 @@ namespace CoreLibs\Create;
class RandomKey
{
// key generation
- /** @var array */
- private static $key_range = [];
+ /** @var string */
+ private static $key_range = '';
/** @var int */
private static $one_key_length;
/** @var int */
@@ -33,9 +33,13 @@ class RandomKey
*/
private static function initRandomKeyData()
{
- // random key generation
- self::$key_range = array_merge(range('A', 'Z'), range('a', 'z'), range('0', '9'));
- self::$one_key_length = count(self::$key_range);
+ // random key generation base string
+ self::$key_range = join('', array_merge(
+ range('A', 'Z'),
+ range('a', 'z'),
+ range('0', '9')
+ ));
+ self::$one_key_length = strlen(self::$key_range);
}
/**
@@ -103,11 +107,11 @@ class RandomKey
} else {
$use_key_length = self::$key_length;
}
-
- $pieces = [];
+ // create random string
+ $random_string = '';
for ($i = 1; $i <= $use_key_length; $i++) {
- $pieces[] = self::$key_range[random_int(0, self::$one_key_length - 1)];
+ $random_string .= self::$key_range[random_int(0, self::$one_key_length - 1)];
}
- return join('', $pieces);
+ return $random_string;
}
}