Class lmbValidatorBuilder

Description

Builds new or fills with the rules existing lmbValidator object, simplifying constructing rules

Located in /validation/src/lmbValidatorBuilder.class.php (line 20)


	
			
Variable Summary
 static array $rules_shortcuts
Method Summary
 static void addRules (array $rules_lists, lmbValidator $validator)
 static object fully build ( $rules_list)
 static void getLmbRule ( $underscored_name)
 static void getPathByRuleName ( $rule_name)
 static object parseRule (string $field, string $rule, [mixed $args = ''])
 static void trim ( $arr)
Variables
static array $rules_shortcuts = array(
'matches' => 'match',
'not_matches' => 'invalid_value',
'min_length' => 'size_range',
'max_length' => 'size_range',
'range_length' => 'size_range',
'mb_min_length' => 'i18_n_size_range',
'mb_max_length' => 'i18_n_size_range',
'mb_range_length' => 'i18_n_size_range',
'min' => 'numeric_value_range',
'max' => 'numeric_value_range',
'range' => 'numeric_value_range'
)
(line 28)
  • todo: correct working of common rules shortcuts, i.e. min shortcut does not work now
  • access: protected
Methods
static addRules (line 60)

Main function for building rules.

void addRules (array $rules_lists, lmbValidator $validator)
  • array $rules_lists:

    - list (array) of rules' lists, $field => $list. List of rules can be a string: $rules_lists['field'] = 'rule1|rule2|rule3'; or an array: $rules_lists['field'] = array($rule1, $rule2, $rule3);

    Rules can be in several formats: $rule['field'] = array( 'rule1[param1, param2]', // simple rule format - rule, followed by optional params in square brackets 'rule2[param1]' => 'error2', // extended rule format, simple rule format => error message. 'rule3' => 'error3' );

  • object $validator: (optional)
static build (line 96)
  • return: built validator
object fully build ( $rules_list)
  • $rules_list
static getLmbRule (line 162)
void getLmbRule ( $underscored_name)
  • $underscored_name
static getPathByRuleName (line 145)
void getPathByRuleName ( $rule_name)
  • $rule_name
static parseRule (line 111)

Parse text representation of a rule and return rule object

  • access: protected
object parseRule (string $field, string $rule, [mixed $args = ''])
  • string $field
  • string $rule
  • mixed $args
static trim (line 172)
void trim ( $arr)
  • $arr

Documentation generated on Wed, 07 Jan 2009 03:52:52 +0300 by phpDocumentor 1.3.2