Framework/Validator/Validator.php
/**
	 * Validate array using arrays for input and rules
	 * 
	 * @param  array  $inputArray
	 * @param  array  $arrayRules
	 * @return void
	 */
Validate array using arrays for input and rules

@param  array  $inputArray
@param  array  $arrayRules
@return void
Validate array using arrays for input and rules @param array $inputArray @param array $arrayRules @return void
public function validateArray(array $inputArray, array $arrayRules)
	{
		$checkFields = $this->makeCheckFields($arrayRules);
		foreach ($arrayRules as $ruleKey => $ruleValue) {
			if (array_key_exists($ruleKey, $inputArray)) {
				$rulesForValidation = $checkFields[$ruleKey]['rules'];
				if (array_key_exists('params', $checkFields[$ruleKey])) {
					$paramsForValidation = $checkFields[$ruleKey]['params'];
				} else {
					$paramsForValidation = [];
				}
				$inputArg = [$ruleKey => $inputArray[$ruleKey]];
				$this->validateArg($inputArg, $rulesForValidation, $paramsForValidation);
			}
		}
	}
public function validateArray ( array $ inputArray , array $ arrayRules ) { $ checkFields = $ this -> makeCheckFields ( $ arrayRules ) ; foreach ( $ arrayRules as $ ruleKey => $ ruleValue ) { if ( array_key_exists ( $ ruleKey , $ inputArray ) ) { $ rulesForValidation = $ checkFields [ $ ruleKey ] [ 'rules' ] ; if ( array_key_exists ( 'params' , $ checkFields [ $ ruleKey ] ) ) { $ paramsForValidation = $ checkFields [ $ ruleKey ] [ 'params' ] ; } else { $ paramsForValidation = [ ] ; } $ inputArg = [ $ ruleKey => $ inputArray [ $ ruleKey ] ] ; $ this -> validateArg ( $ inputArg , $ rulesForValidation , $ paramsForValidation ) ; } } }
Validate array using arrays for input and rules
Validate array using arrays for input and rules