Validators
class Validators
Validation utilities.
Constants
private BuiltinTypes |
|
Properties
static protected | $validators | ||
static protected array<string,callable> | $counters |
Methods
Verifies that the value is of expected types separated by pipe.
Verifies that element $key in array is of expected types separated by pipe.
Verifies that the value is of expected types separated by pipe.
Finds whether all values are of expected types separated by pipe.
Checks if the value is an integer or a float.
Checks if the value is an integer or a integer written in a string.
Checks if the value is a number or a number written in a string.
Checks if the value is a syntactically correct callback.
Checks if the value is a valid UTF-8 string.
Checks if the value is 0, '', false or null.
No description
Checks if the value is in the given range [min, max], where the upper or lower limit can be omitted (null).
Checks if the value is a valid email address. It does not verify that the domain actually exists, only the syntax is verified.
Checks if the value is a valid URL address.
Checks if the value is a valid URI address, that is, actually a string beginning with a syntactically valid schema.
Checks whether the input is a class, interface or trait.
Checks whether the input is a valid PHP identifier.
Determines if type is PHP built-in type. Otherwise, it is the class name.
Determines if type is special class name self/parent/static.
Checks whether the given type declaration is syntactically valid.
Details
at line 99
static void
assert(mixed $value, string $expected, string $label = 'variable')
Verifies that the value is of expected types separated by pipe.
at line 122
static void
assertField(array $array, int|string $key, string|null $expected = null, string $label = "item '%' in array")
Verifies that element $key in array is of expected types separated by pipe.
at line 142
static bool
is(mixed $value, string $expected)
Verifies that the value is of expected types separated by pipe.
at line 204
static bool
everyIs(iterable $values, string $expected)
Finds whether all values are of expected types separated by pipe.
at line 220
static bool
isNumber(mixed $value)
Checks if the value is an integer or a float.
at line 230
static bool
isNumericInt(mixed $value)
Checks if the value is an integer or a integer written in a string.
at line 240
static bool
isNumeric(mixed $value)
Checks if the value is a number or a number written in a string.
at line 250
static bool
isCallable(mixed $value)
Checks if the value is a syntactically correct callback.
at line 260
static bool
isUnicode(mixed $value)
Checks if the value is a valid UTF-8 string.
at line 270
static bool
isNone(mixed $value)
Checks if the value is 0, '', false or null.
at line 277
static bool
isMixed()
internal |
No description
at line 289
static bool
isList(mixed $value)
deprecated
deprecated
Checks if a variable is a zero-based integer indexed array.
at line 300
static bool
isInRange(mixed $value, array $range)
Checks if the value is in the given range [min, max], where the upper or lower limit can be omitted (null).
Numbers, strings and DateTime objects can be compared.
at line 326
static bool
isEmail(string $value)
Checks if the value is a valid email address. It does not verify that the domain actually exists, only the syntax is verified.
at line 345
static bool
isUrl(string $value)
Checks if the value is a valid URL address.
at line 369
static bool
isUri(string $value)
Checks if the value is a valid URI address, that is, actually a string beginning with a syntactically valid schema.
at line 378
static bool
isType(string $type)
Checks whether the input is a class, interface or trait.
at line 387
static bool
isPhpIdentifier(string $value)
Checks whether the input is a valid PHP identifier.
at line 396
static bool
isBuiltinType(string $type)
Determines if type is PHP built-in type. Otherwise, it is the class name.
at line 405
static bool
isClassKeyword(string $name)
Determines if type is special class name self/parent/static.
at line 414
static bool
isTypeDeclaration(string $type)
Checks whether the given type declaration is syntactically valid.
Traits
Static class.