Methods
Strictly check that the provided value is numeric or throw an exception
forceNumeric(mixed $value,string $valueName = '',string $errorMessage = 'must be numeric'): void
static
Throws |
- \InvalidArgumentException
If the check fails
|
Arguments
$value
mixed
A value to check
$valueName
string
The name of the value to be shown at the beginning of the exception message
$errorMessage
string
The rest of the exception message
Strictly check that the provided value is a positive integer or throw an exception
forcePositiveInteger(mixed $value,string $valueName = '',string $errorMessage = 'must be a positive integer'): void
static
Throws |
- \InvalidArgumentException
If the check fails
|
Arguments
$value
mixed
A value to check
$valueName
string
The name of the value to be shown at the beginning of the exception message
$errorMessage
string
The rest of the exception message
Generate a random integer between the specified range (both extremes are included).
generateRandomInteger(integer $min,integer $max): integer
static
Throws |
- \UnexpectedValueException
if max is equal or less than min.
|
Arguments
$min
integer
lowest possible value (negative values are allowed)
$max
integer
highest possible value (negative values are allowed)
Response
integer
A random integer value between min and max
Get the number represented by the given value
getNumeric(mixed $value): \org\turbocommons\src\main\php\utils\number
static
Warning: count(): Parameter must be an array or an object that implements Countable in phar://D:/Storage/Backups/Git/TurboBuilder/TurboBuilder-Node/src/main/libs/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275
Warning: count(): Parameter must be an array or an object that implements Countable in phar://D:/Storage/Backups/Git/TurboBuilder/TurboBuilder-Node/src/main/libs/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275
Arguments
$value
mixed
A value to convert to a number
Response
\org\turbocommons\src\main\php\utils\number
The numeric type representation from the given value. For example, a string '0001' will return 1
Tells if the given value is a numeric integer or not
isInteger(mixed $value): boolean
static
Warning: count(): Parameter must be an array or an object that implements Countable in phar://D:/Storage/Backups/Git/TurboBuilder/TurboBuilder-Node/src/main/libs/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275
Warning: count(): Parameter must be an array or an object that implements Countable in phar://D:/Storage/Backups/Git/TurboBuilder/TurboBuilder-Node/src/main/libs/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275
Arguments
$value
mixed
A value to check
Response
boolean
true if the given value is a numeric integer or represents a numeric integer value, false otherwise
Tells if the given value is numeric or not
isNumeric(mixed $value): boolean
static
Warning: count(): Parameter must be an array or an object that implements Countable in phar://D:/Storage/Backups/Git/TurboBuilder/TurboBuilder-Node/src/main/libs/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275
Warning: count(): Parameter must be an array or an object that implements Countable in phar://D:/Storage/Backups/Git/TurboBuilder/TurboBuilder-Node/src/main/libs/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1275
Arguments
$value
mixed
A value to check
Response
boolean
true if the given value is numeric or represents a numeric value, false otherwise