Packages

  • Nette
    • Application
      • Diagnostics
      • Responses
      • Routers
      • UI
    • Caching
      • Storages
    • ComponentModel
    • Config
      • Adapters
      • Extensions
    • Database
      • Diagnostics
      • Drivers
      • Reflection
      • Table
    • DI
      • Diagnostics
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Latte
      • Macros
    • Loaders
    • Localization
    • Mail
    • Reflection
    • Security
      • Diagnostics
    • Templating
    • Utils
      • PhpGenerator
  • NetteModule
  • none

Classes

Exceptions

  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Other releases
  • Nette homepage

Class Validators

Validation utilities.

Object
Extended by Validators
Package: 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 URL.

Finds whether a string is a valid URL.

Parameters

$value
string

Returns

boolean
Methods inherited from 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(__CLASS__, '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'), 'none' => array(__CLASS__, 'isNone'), '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('Strings', 'length'), 'array' => 'count', 'list' => 'count', 'alnum' => 'strlen', 'alpha' => 'strlen', 'digit' => 'strlen', 'lower' => 'strlen', 'space' => 'strlen', 'upper' => 'strlen', 'xdigit' => 'strlen', )
#
Magic properties inherited from Object
$reflection
Nette Framework 2.0.18 (for PHP 5.2, un-prefixed) API documentation generated by ApiGen 2.8.0