Namespaces

  • Latte
    • Loaders
    • Macros
    • Runtime
  • Nette
    • Application
      • Responses
      • Routers
      • UI
    • Bridges
      • ApplicationDI
      • ApplicationLatte
      • ApplicationTracy
      • CacheDI
      • CacheLatte
      • DatabaseDI
      • DatabaseTracy
      • DITracy
      • FormsDI
      • FormsLatte
      • Framework
      • HttpDI
      • HttpTracy
      • MailDI
      • ReflectionDI
      • SecurityDI
      • SecurityTracy
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Conventions
      • Drivers
      • Table
    • DI
      • Config
        • Adapters
      • Extensions
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Loaders
    • Localization
    • Mail
    • Neon
    • PhpGenerator
      • Traits
    • Reflection
    • Security
    • Tokenizer
    • Utils
  • Tracy
    • Bridges
      • Nette
  • none

Classes

  • ArrayHash
  • ArrayList
  • Arrays
  • Callback
  • DateTime
  • FileSystem
  • Finder
  • Html
  • Image
  • Json
  • ObjectHelpers
  • ObjectMixin
  • Paginator
  • Random
  • Reflection
  • SafeStream
  • Strings
  • TokenIterator
  • Tokenizer
  • Validators

Interfaces

  • IHtmlString

Exceptions

  • AssertionException
  • ImageException
  • JsonException
  • RegexpException
  • TokenizerException
  • UnknownImageFileException
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Other releases

Class Validators

Validation utilities.

Nette\Utils\Validators uses Nette\StaticClass
Namespace: Nette\Utils
Located at Utils/Validators.php
Methods summary
public static
# assert( mixed $value, string $expected, string $label = 'variable' )

Throws exception if a variable is of unexpected type.

Throws exception if a variable is of unexpected type.

Parameters

$value
$expected
types separated by pipe
$label
label
public static
# assertField( array $arr, string $field, string $expected = null, string $label = "item '%' in array" )

Throws exception if an array field is missing or of unexpected type.

Throws exception if an array field is missing or of unexpected type.

Parameters

$arr
$field
item
$expected
types separated by pipe
$label
public static boolean
# is( mixed $value, string $expected )

Finds whether a variable is of expected type.

Finds whether a variable is of expected type.

Parameters

$value
$expected
types separated by pipe with optional ranges

Returns

boolean
bool
public static boolean
# everyIs( array|Traversable $values, string $expected )

Finds whether all values are of expected type.

Finds whether all values are of expected type.

Parameters

$values
$expected
types separated by pipe with optional ranges

Returns

boolean
bool
public static boolean
# isNumber( $value )

Finds whether a value is an integer or a float.

Finds whether a value is an integer or a float.

Returns

boolean
bool
public static boolean
# isNumericInt( $value )

Finds whether a value is an integer.

Finds whether a value is an integer.

Returns

boolean
bool
public static boolean
# isNumeric( $value )

Finds whether a string is a floating point number in decimal base.

Finds whether a string is a floating point number in decimal base.

Returns

boolean
bool
public static boolean
# isCallable( $value )

Finds whether a value is a syntactically correct callback.

Finds whether a value is a syntactically correct callback.

Returns

boolean
bool
public static boolean
# isUnicode( string $value )

Finds whether a value is an UTF-8 encoded string.

Finds whether a value is an UTF-8 encoded string.

Parameters

$value

Returns

boolean
bool
public static boolean
# isNone( $value )

Finds whether a value is "falsy".

Finds whether a value is "falsy".

Returns

boolean
bool
public static boolean
# isList( array $value )

Finds whether a variable is a zero-based integer indexed array.

Finds whether a variable is a zero-based integer indexed array.

Parameters

$value

Returns

boolean
bool
public static boolean
# isInRange( mixed $value, array $range )

Is a value in specified range?

Is a value in specified range?

Parameters

$value
$range
and max value pair

Returns

boolean
bool
public static boolean
# isEmail( string $value )

Finds whether a string is a valid email address.

Finds whether a string is a valid email address.

Parameters

$value

Returns

boolean
bool
public static boolean
# isUrl( string $value )

Finds whether a string is a valid http(s) URL.

Finds whether a string is a valid http(s) URL.

Parameters

$value

Returns

boolean
bool
public static boolean
# isUri( string $value )

Finds whether a string is a valid URI according to RFC 1738.

Finds whether a string is a valid URI according to RFC 1738.

Parameters

$value

Returns

boolean
bool
public static boolean
# isType( string $type )

Checks whether the input is a class, interface or trait.

Checks whether the input is a class, interface or trait.

Parameters

$type

Returns

boolean
bool
public static boolean
# isPhpIdentifier( $value )

Checks whether the input is a valid PHP identifier.

Checks whether the input is a valid PHP identifier.

Returns

boolean
bool
Methods used from Nette\StaticClass
__callStatic(), __construct()
Properties summary
protected static array $validators
#[ 'bool' => 'is_bool', 'boolean' => 'is_bool', 'int' => 'is_int', 'integer' => 'is_int', 'float' => 'is_float', 'number' => [__CLASS__, 'isNumber'], 'numeric' => [__CLASS__, 'isNumeric'], 'numericint' => [__CLASS__, 'isNumericInt'], 'string' => 'is_string', 'unicode' => [__CLASS__, 'isUnicode'], 'array' => 'is_array', 'list' => [Arrays::class, 'isList'], 'object' => 'is_object', 'resource' => 'is_resource', 'scalar' => 'is_scalar', 'callable' => [__CLASS__, 'isCallable'], 'null' => 'is_null', 'email' => [__CLASS__, 'isEmail'], 'url' => [__CLASS__, 'isUrl'], 'uri' => [__CLASS__, 'isUri'], 'none' => [__CLASS__, 'isNone'], 'type' => [__CLASS__, 'isType'], 'identifier' => [__CLASS__, 'isPhpIdentifier'], 'pattern' => null, 'alnum' => 'ctype_alnum', 'alpha' => 'ctype_alpha', 'digit' => 'ctype_digit', 'lower' => 'ctype_lower', 'upper' => 'ctype_upper', 'space' => 'ctype_space', 'xdigit' => 'ctype_xdigit', 'iterable' => [__CLASS__, 'isIterable'], ]
protected static array $counters
#[ 'string' => 'strlen', 'unicode' => [Strings::class, 'length'], 'array' => 'count', 'list' => 'count', 'alnum' => 'strlen', 'alpha' => 'strlen', 'digit' => 'strlen', 'lower' => 'strlen', 'space' => 'strlen', 'upper' => 'strlen', 'xdigit' => 'strlen', ]
Nette 2.4-20180918 API API documentation generated by ApiGen 2.8.0