Claro_Validator_ValueType Class Reference

Inheritance diagram for Claro_Validator_ValueType:
Claro_Validator

Public Member Functions

 __construct ($type)
 isValid ($value)

Static Protected Attributes

static $supportedType

Static Private Member Functions

static booleanString ($value)
static floatString ($value)
static integerString ($value)

Detailed Description

Validator that checks the data type of a value

Definition at line 67 of file validator.lib.php.


Constructor & Destructor Documentation

__construct ( type  ) 

Allowed types are

  • alnum : the value is an alpha-numeric string
  • alpha : the value only containes alphabetical chars
  • array : the value is an array
  • bool : the value is a boolean
  • boolstr : the value is the string 'true' or 'false'
  • digit : the value is a string containing only digits
  • float : the value is a float
  • floatstr : the value is a float or the string representation of a float
  • int : the value is an integer
  • intstr : the value is a integer or the string representation of an integer
  • lower : ths value is a lower case string
  • null : the value is null
  • numeric : the value is a number or a string representation of a number
  • object : the value is an object
  • space : the value is a string only containing white spaces
  • string : the value is a string
  • upper : the value is an upper case
  • xdigit : the value is a string representation of an hexadecimal number WARNING : do not use int, float, bool for strings representations, it will fail. Use digit, numeric, intstr, floatstr and boolstr instead.
    Parameters:
    string $type;
    Exceptions:
    Claro_Validator_Exception if $type is not supported

Definition at line 115 of file validator.lib.php.


Member Function Documentation

static booleanString ( value  )  [static, private]

Definition at line 142 of file validator.lib.php.

static floatString ( value  )  [static, private]

Definition at line 147 of file validator.lib.php.

static integerString ( value  )  [static, private]

Definition at line 152 of file validator.lib.php.

isValid ( value  ) 
See also:
Claro_Validator

Implements Claro_Validator.

Definition at line 130 of file validator.lib.php.


Field Documentation

$supportedType [static, protected]
Initial value:
 array(
        'alnum'     => 'ctype_alnum',
        'alpha'     => 'ctype_alpha',
        'array'     => 'is_array',
        'bool'      => 'is_bool',
        'boolstr'   => array('Claro_Validator_ValueType', 'booleanString'),
        'digit'     => 'ctype_digit',
        'float'     => 'is_float',
        'floatstr'  => array('Claro_Validator_ValueType', 'floatString'),
        'int'       => 'is_int',
        'intstr'    => array('Claro_Validator_ValueType', 'integerString'),
        'lower'     => 'ctype_lower',
        'null'      => 'is_null',
        'numeric'   => 'is_numeric',
        'object'    => 'is_object',
        'space'     => 'ctype_space',
        'string'    => 'is_string',
        'upper'     => 'ctype_upper',
        'xdigit'    => 'ctype_xdigit',
        )

Definition at line 69 of file validator.lib.php.


The documentation for this class was generated from the following file:
Generated on Tue Jun 8 12:28:38 2010 for Claroline API by  doxygen 1.6.3