Utilities
abstract class Utilities
Abstract with some global static utility functions
Properties
| static private | $chars |
Methods
Returns the number of possible characters for a digit in Random
Returns a random string with the given length
Encodes the data as JSON
Decodes the JSON data as an array
Returns the best password_hash algorithm available
Returns the last element of an array or null if it's empty
Deletes any of the given value from the given array reference
Returns a class name with the namespace stripped
Returns the given string with the first character capitalized
Returns a size string converted to bytes
Equivalent to str_replace but only does one replacement
Captures and returns any echoes or prints in the given function
Performs a key-based array map
Returns all classes that are a $match type
Runs the given function with no execution timeouts or user aborts
Details
at line 116
static int
RandomRange()
Returns the number of possible characters for a digit in Random
at line 119
static string
Random(int $length)
Returns a random string with the given length
at line 132
static string
JSONEncode($data)
Encodes the data as JSON
at line 143
static
JSONDecode(string $data)
Decodes the JSON data as an array
at line 151
static
GetHashAlgo()
Returns the best password_hash algorithm available
at line 159
static
array_last(array|null $arr)
Returns the last element of an array or null if it's empty
at line 167
static array
delete_value(array $arr, $value)
Deletes any of the given value from the given array reference
at line 173
static string|null
ShortClassName(string|null $class)
Returns a class name with the namespace stripped
at line 177
static string
FirstUpper(string $str)
Returns the given string with the first character capitalized
at line 185
static int
return_bytes(string $val)
Returns a size string converted to bytes
at line 200
static string
replace_first(string $search, string $replace, string $subject)
Equivalent to str_replace but only does one replacement
at line 212
static string
CaptureOutput(callable $func)
Captures and returns any echoes or prints in the given function
at line 222
static array
array_map_keys(callable $func, array $keys)
Performs a key-based array map
at line 228
static array
getClassesMatching(string $match)
Returns all classes that are a $match type
at line 235
static
RunAtomic(callable $func)
Runs the given function with no execution timeouts or user aborts