protected function validate_by_key( $values ) {

		$is_valid = TRUE;

		if ( count( $this->validators_by_key ) < 1 ) {

			return $is_valid;
		}

		foreach ( $values as $key => $value ) {
			if ( ! is_scalar( $value ) || ! isset( $this->validators_by_key[ $key ] ) ) {
				continue;
			}

			/** @var $validators ValidatorInterface[] */
			$validators = $this->validators_by_key[ $key ];
			foreach ( $validators as $validator ) {
				$is_valid = $validator->is_valid( $value );

				if ( ! $is_valid ) {
					$this->error_messages[ $key ] = $validator->get_error_messages();
					break;
				}
			}

			if ( ! $is_valid ) {
				break;
			}
		}

		return $is_valid;
	}
protected function validate_by_key( $values ) {

		$is_valid = TRUE;

		if ( count( $this->validators_by_key ) < 1 ) {

			return $is_valid;
		}

		foreach ( $values as $key => $value ) {
			if ( ! is_scalar( $value ) || ! isset( $this->validators_by_key[ $key ] ) ) {
				continue;
			}

			/** @var $validators ValidatorInterface[] */
			$validators = $this->validators_by_key[ $key ];
			foreach ( $validators as $validator ) {
				$is_valid = $validator->is_valid( $value );

				if ( ! $is_valid ) {
					$this->error_messages[ $key ] = $validator->get_error_messages();
					break;
				}
			}

			if ( ! $is_valid ) {
				break;
			}
		}

		return $is_valid;
	}
protected function validate_by_key ( $ values ) { $ is_valid = TRUE ; if ( count ( $ this -> validators_by_key ) < 1 ) { return $ is_valid ; } foreach ( $ values as $ key => $ value ) { if ( ! is_scalar ( $ value ) || ! isset ( $ this -> validators_by_key [ $ key ] ) ) { continue ; } /** @var $validators ValidatorInterface[] */ $ validators = $ this -> validators_by_key [ $ key ] ; foreach ( $ validators as $ validator ) { $ is_valid = $ validator -> is_valid ( $ value ) ; if ( ! $ is_valid ) { $ this -> error_messages [ $ key ] = $ validator -> get_error_messages ( ) ; break ; } } if ( ! $ is_valid ) { break ; } } return $ is_valid ; }
Validates all values by array-key.

TODO: Add option to validate recursive through an array with RecursiveArrayIterator.

@param   mixed $values

@return  bool TRUE|FALSE

@deprecated
Validates all values by array - key .