pclib  2.3.2
Lightweight PHP framework
Public Member Functions
Validator Class Reference

Validator with common validation rules. More...

Inheritance diagram for Validator:
ValidatorBase BaseObject

Public Member Functions

 matchPattern ($value, $pattern)
 Rule handler: Match regexp pattern. More...
 
 isEmail ($value)
 Rule handler: Email address. More...
 
 isUrl ($value)
 Rule handler: URL starting http://. More...
 
 isIdentifier ($value)
 Rule handler: Match php identifier. More...
 
 minLength ($value, $length)
 Rule handler: Minimum number of characters. More...
 
 matchShell ($value, $wildcards)
 Rule handler: Match wildcards. More...
 
 isNumeric ($value)
 Rule handler: Match number or numeric string. More...
 
 isNumericInt ($value)
 Rule handler: Match integer. More...
 
 inRange ($value, $range)
 Rule handler: Check if value is in range [min, max]. More...
 
 isDateTime ($value, $format= '')
 Rule handler: Match datetime against format $format. More...
 
 isTime ($value)
 Rule handler: Match time in format HH:MM:SS. More...
 
- Public Member Functions inherited from ValidatorBase
 setRule ($name, $function, $message)
 Set or add new rule. More...
 
 hasRule ($rule)
 Check if validator has handler for rule $rule. More...
 
 setError ($id, $messageId, array $args=array())
 Set error message for element $id. More...
 
 getErrors ()
 Return validation errors.
 
 isBlank ($value)
 Check if field is blank (not filled).
 
 notBlank ($value)
 NOT isBlank().
 
 validate ($value, $rules)
 Validate $value against $rules. More...
 
 validateElement ($value, array $elem)
 Validate $value against $elem rules. More...
 
 validateArray (array $values, array $elements)
 Validate array of values, using validation rules in $elements. More...
 
- Public Member Functions inherited from BaseObject
 loadDefaults ($className=null)
 Load default parameters of class $className into object instance.
 
 setProperties (array $defaults)
 Set public properties of object from the array. More...
 
 addEvent ($name, $callback)
 Add event handler to $object->$name property. More...
 
 toArray ()
 Convert object to array. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from BaseObject
static defaults ()
 Set or retireve default parameters of the object. More...
 
- Data Fields inherited from ValidatorBase
 $skipUndefined = false
 Are variables undefined in template valid?
 
 $skipUndefinedRule = false
 Silently skip unknown rules?
 
 $ignoredAttributes = array('id', 'type', 'begin', 'end')
 List of ignored attributes (rules)
 
 $ignoredElements = array()
 List of ignored element types.
 
 $messages
 Array of messages [ruleName: message, ...].
 
 $translator
 var Translator
 
 $onValidateElement
 Occurs before element validation. More...
 
- Data Fields inherited from BaseObject
 $onNewInstance
 Occurs when new instance of the class is created. More...
 
 $onMissingMethod
 Occurs when called method does not exist. More...
 
 $serviceLocator
 var function() Return service object when requested with service(). More...
 
- Protected Member Functions inherited from ValidatorBase
 validateRule ($value, $rule, $param=null)
 Validate $value using $rule. More...
 
- Protected Member Functions inherited from BaseObject
 fireEvent ($name, array $args=array())
 Run all event handlers in $object->$name property. More...
 
 service ($service, $default=null)
 Try acquire $service and load it into property $this->$service. More...
 
- Protected Attributes inherited from ValidatorBase
 $rules = array()
 Array of rule handlers [ruleName: callable, ...].
 
 $errors = array()
 Array of [fieldName: errorMessage, ...].
 
 $parser
 var TplParser
 

Detailed Description

Validator with common validation rules.

Member Function Documentation

inRange (   $value,
  $range 
)

Rule handler: Check if value is in range [min, max].

isDateTime (   $value,
  $format = '' 
)

Rule handler: Match datetime against format $format.

isEmail (   $value)

Rule handler: Email address.

isIdentifier (   $value)

Rule handler: Match php identifier.

isNumeric (   $value)

Rule handler: Match number or numeric string.

isNumericInt (   $value)

Rule handler: Match integer.

isTime (   $value)

Rule handler: Match time in format HH:MM:SS.

isUrl (   $value)

Rule handler: URL starting http://.

matchPattern (   $value,
  $pattern 
)

Rule handler: Match regexp pattern.

matchShell (   $value,
  $wildcards 
)

Rule handler: Match wildcards.

minLength (   $value,
  $length 
)

Rule handler: Minimum number of characters.


The documentation for this class was generated from the following file: