public static function dec2hex (int $dec, int $maxLength = 0) {
// Check parameter
//* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('STRING-UTILS: dec=%d,maxLength=%d - CALLED!', $dec, $maxLength));
- if (empty($dec)) {
+ if ($dec < 0) {
// Throw IAE
- throw new InvalidArgumentException('Parameter "dec" is empty');
+ throw new InvalidArgumentException(sprintf('dec=%d is below zero', $dec));
} elseif ($maxLength != 0 && ($maxLength % 2) != 0) {
// Throw it again
throw new InvalidArgumentException(sprintf('maxLength=%d is not dividable by 2 or zero', $maxLength));
public static function dec2asc (int $dec) {
// Check parameter
//* NOISY-DEBUG */ self::createDebugInstance(__CLASS__, __LINE__)->traceMessage(sprintf('STRING-UTILS: dec=%d - CALLED!', $dec));
- if (empty($dec)) {
+ if ($dec < 0) {
// Throw IAE
- throw new InvalidArgumentException('Parameter "dec" is empty');
+ throw new InvalidArgumentException(sprintf('dec=%d is below zero', $dec));
}
// First convert the number into a hexadecimal string