Namespaces

  • Latte
    • Loaders
    • Macros
    • Runtime
  • Nette
    • Application
      • Responses
      • Routers
      • UI
    • Bridges
      • ApplicationLatte
      • ApplicationTracy
      • CacheLatte
      • DatabaseDI
      • DatabaseTracy
      • DITracy
      • FormsLatte
      • Framework
      • HttpTracy
      • SecurityTracy
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Drivers
      • Reflection
      • Table
    • DI
      • Config
        • Adapters
      • Extensions
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Latte
    • Loaders
    • Localization
    • Mail
    • Neon
    • PhpGenerator
    • Reflection
    • Security
    • Templating
    • Utils
  • NetteModule
  • none
  • Tracy

Classes

  • ArrayHash
  • ArrayList
  • Arrays
  • Callback
  • DateTime
  • FileSystem
  • Finder
  • Html
  • Image
  • Json
  • LimitedScope
  • MimeTypeDetector
  • ObjectMixin
  • Paginator
  • Random
  • Strings
  • TokenIterator
  • Tokenizer
  • Validators

Interfaces

  • IHtmlString

Exceptions

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

Class Validators

Validation utilities.

Nette\Object
Extended by Nette\Utils\Validators
Namespace: Nette\Utils
Author: David Grudl
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
mixed
$expected
string
expected types separated by pipe
$label
string
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
array
$field
string
item
$expected
string
expected types separated by pipe
$label
string
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
mixed
$expected
string
expected types separated by pipe with optional ranges

Returns

boolean
public static boolean
# isNumericInt( $value )

Finds whether a value is an integer.

Finds whether a value is an integer.

Returns

boolean
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
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
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
string

Returns

boolean
public static boolean
# isNone( $value )

Finds whether a value is "falsy".

Finds whether a value is "falsy".

Returns

boolean
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
array

Returns

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

Is a value in specified range?

Is a value in specified range?

Parameters

$value
mixed
$range
array
min and max value pair

Returns

boolean
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
string

Returns

boolean
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
string

Returns

boolean
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
string

Returns

boolean
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
string

Returns

boolean
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
Methods inherited from Nette\Object
__call(), __callStatic(), __get(), __isset(), __set(), __unset(), extensionMethod(), getReflection()
Properties summary
protected static array $validators array( 'bool' => 'is_bool', 'boolean' => 'is_bool', 'int' => 'is_int', 'integer' => 'is_int', 'float' => 'is_float', 'number' => NULL, // is_int || is_float, 'numeric' => array(__CLASS__, 'isNumeric'), 'numericint' => array(__CLASS__, 'isNumericInt'), 'string' => 'is_string', 'unicode' => array(__CLASS__, 'isUnicode'), 'array' => 'is_array', 'list' => array('Nette\Utils\Arrays', 'isList'), 'object' => 'is_object', 'resource' => 'is_resource', 'scalar' => 'is_scalar', 'callable' => array(__CLASS__, 'isCallable'), 'null' => 'is_null', 'email' => array(__CLASS__, 'isEmail'), 'url' => array(__CLASS__, 'isUrl'), 'uri' => array(__CLASS__, 'isUri'), 'none' => array(__CLASS__, 'isNone'), 'type' => array(__CLASS__, 'isType'), 'identifier' => array(__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', )
#
protected static array $counters array( 'string' => 'strlen', 'unicode' => array('Nette\Utils\Strings', 'length'), 'array' => 'count', 'list' => 'count', 'alnum' => 'strlen', 'alpha' => 'strlen', 'digit' => 'strlen', 'lower' => 'strlen', 'space' => 'strlen', 'upper' => 'strlen', 'xdigit' => 'strlen', )
#
Magic properties inherited from Nette\Object
$reflection
Nette 2.2 API documentation generated by ApiGen 2.8.0