Helpers
class Helpers
Miscellaneous utilities.
Constants
| IsWindows |
|
Methods
No description
Returns the last occurred PHP error or an empty string if no error occurred. Unlike error_get_last(), it is not affected by the PHP directive html_errors and always returns text, not HTML.
Converts false to null, does not change other values.
Returns value clamped to the inclusive range of min and max.
Finds the string from $possibilities most similar to $value using Levenshtein distance, or null if none is close enough.
Compares two values in the same way that PHP does. Recognizes operators: >, >=, <, <=, =, ==, ===, !=, !==, <>
Splits a class name into namespace and short class name.
Details
at line 27
static string
capture(callable $func)
No description
at line 44
static string
getLastError()
Returns the last occurred PHP error or an empty string if no error occurred. Unlike error_get_last(), it is not affected by the PHP directive html_errors and always returns text, not HTML.
at line 56
static mixed
falseToNull(mixed $value)
Converts false to null, does not change other values.
at line 66
static int|float
clamp(int|float $value, int|float $min, int|float $max)
Returns value clamped to the inclusive range of min and max.
at line 80
static string|null
getSuggestion(array $possibilities, string $value)
Finds the string from $possibilities most similar to $value using Levenshtein distance, or null if none is close enough.
at line 99
static bool
compare(mixed $left, string $operator, mixed $right)
Compares two values in the same way that PHP does. Recognizes operators: >, >=, <, <=, =, ==, ===, !=, !==, <>
at line 119
static array
splitClassName(string $name)
Splits a class name into namespace and short class name.