protected function _checkConfig( array $config, array $attributes )
	{
		$errors = array();

		foreach ( $config as $key => $def )
		{
			if( $def['required'] === true && ( !isset( $attributes[$key] ) || $attributes[$key] === '' ) )
			{
				$errors[$key] = sprintf( 'Required attribute "%1$s" in provider configuration not available', $key );
				continue;
			}

			if( isset( $attributes[$key] ) )
			{
				switch( $def['type'] )
				{
					case 'boolean':
						if( $attributes[$key] != '0' && $attributes[$key] != '1' ) {
							$errors[$key] = 'Not a true/false value'; continue 2;
						}
						break;
					case 'string':
						if( is_string( $attributes[$key] ) === false ) {
							$errors[$key] = 'Not a string'; continue 2;
						}
						break;
					case 'integer':
						if( ctype_digit( $attributes[$key] ) === false ) {
							$errors[$key] = 'Not an integer number'; continue 2;
						}
						break;
					case 'decimal':
					case 'float':
						if( is_numeric( $attributes[$key] ) === false ) {
							$errors[$key] = 'Not a number'; continue 2;
						}
						break;
					case 'datetime':
						$pattern = '/^[0-9]{4}-[0-1][0-9]-[0-3][0-9] [0-2][0-9]:[0-5][0-9]:[0-5][0-9]$';
						if( preg_match( $pattern, $attributes[$key] ) !== 1 ) {
							$errors[$key] = 'Invalid date and time'; continue 2;
						}
						break;
					case 'map':
						if( !is_array( $attributes[$key] ) ) {
							$errors[$key] = 'Not a valid map'; continue 2;
						}
						break;
					default:
						throw new MShop_Service_Exception( sprintf( 'Invalid characters in attribute for provider configuration. Attribute is not of type "%1$s".', $def['type'] ) );
				}
			}

			$errors[$key] = null;
		}

		return $errors;
	}
protected function _checkConfig( array $config, array $attributes )
	{
		$errors = array();

		foreach ( $config as $key => $def )
		{
			if( $def['required'] === true && ( !isset( $attributes[$key] ) || $attributes[$key] === '' ) )
			{
				$errors[$key] = sprintf( 'Required attribute "%1$s" in provider configuration not available', $key );
				continue;
			}

			if( isset( $attributes[$key] ) )
			{
				switch( $def['type'] )
				{
					case 'boolean':
						if( $attributes[$key] != '0' && $attributes[$key] != '1' ) {
							$errors[$key] = 'Not a true/false value'; continue 2;
						}
						break;
					case 'string':
						if( is_string( $attributes[$key] ) === false ) {
							$errors[$key] = 'Not a string'; continue 2;
						}
						break;
					case 'integer':
						if( ctype_digit( $attributes[$key] ) === false ) {
							$errors[$key] = 'Not an integer number'; continue 2;
						}
						break;
					case 'decimal':
					case 'float':
						if( is_numeric( $attributes[$key] ) === false ) {
							$errors[$key] = 'Not a number'; continue 2;
						}
						break;
					case 'datetime':
						$pattern = '/^[0-9]{4}-[0-1][0-9]-[0-3][0-9] [0-2][0-9]:[0-5][0-9]:[0-5][0-9]$';
						if( preg_match( $pattern, $attributes[$key] ) !== 1 ) {
							$errors[$key] = 'Invalid date and time'; continue 2;
						}
						break;
					case 'map':
						if( !is_array( $attributes[$key] ) ) {
							$errors[$key] = 'Not a valid map'; continue 2;
						}
						break;
					default:
						throw new MShop_Service_Exception( sprintf( 'Invalid characters in attribute for provider configuration. Attribute is not of type "%1$s".', $def['type'] ) );
				}
			}

			$errors[$key] = null;
		}

		return $errors;
	}
protected function _checkConfig ( array $ config , array $ attributes ) { $ errors = array ( ) ; foreach ( $ config as $ key => $ def ) { if ( $ def [ 'required' ] === true && ( ! isset ( $ attributes [ $ key ] ) || $ attributes [ $ key ] === '' ) ) { $ errors [ $ key ] = sprintf ( 'Required attribute "%1$s" in provider configuration not available' , $ key ) ; continue ; } if ( isset ( $ attributes [ $ key ] ) ) { switch ( $ def [ 'type' ] ) { case 'boolean' : if ( $ attributes [ $ key ] != '0' && $ attributes [ $ key ] != '1' ) { $ errors [ $ key ] = 'Not a true/false value' ; continue 2 ; } break ; case 'string' : if ( is_string ( $ attributes [ $ key ] ) === false ) { $ errors [ $ key ] = 'Not a string' ; continue 2 ; } break ; case 'integer' : if ( ctype_digit ( $ attributes [ $ key ] ) === false ) { $ errors [ $ key ] = 'Not an integer number' ; continue 2 ; } break ; case 'decimal' : case 'float' : if ( is_numeric ( $ attributes [ $ key ] ) === false ) { $ errors [ $ key ] = 'Not a number' ; continue 2 ; } break ; case 'datetime' : $ pattern = '/^[0-9]{4}-[0-1][0-9]-[0-3][0-9] [0-2][0-9]:[0-5][0-9]:[0-5][0-9]$' ; if ( preg_match ( $ pattern , $ attributes [ $ key ] ) !== 1 ) { $ errors [ $ key ] = 'Invalid date and time' ; continue 2 ; } break ; case 'map' : if ( ! is_array ( $ attributes [ $ key ] ) ) { $ errors [ $ key ] = 'Not a valid map' ; continue 2 ; } break ; default : throw new MShop_Service_Exception ( sprintf ( 'Invalid characters in attribute for provider configuration. Attribute is not of type "%1$s".' , $ def [ 'type' ] ) ) ; } } $ errors [ $ key ] = null ; } return $ errors ; }
Checks required fields and the types of the config array.

@param array $config Config parameters
@param array $attributes Attributes for the config array
@return array An array with the attribute keys as key and an error message as values for all attributes that are
known by the provider but aren't valid resp. null for attributes whose values are OK
Checks required fields and the types of the config array .