public static function type_set_before($var, array $settings)
	{
		$var    = is_array($var) ? implode(',', $var) : strval($var);
		$values = array_filter(explode(',', trim($var)));

		if ($settings['data_type'] == 'enum' and count($values) > 1)
		{
			throw new InvalidContentType('Enum cannot have more than 1 value.');
		}

		foreach ($values as $val)
		{
			if ( ! in_array($val, $settings['options']))
			{
				throw new InvalidContentType('Invalid value given for '.ucfirst($settings['data_type']).
					', value "'.$var.'" not in available options: "'.implode(', ', $settings['options']).'".');
			}
		}

		return $var;
	}
public static function type_set_before($var, array $settings)
	{
		$var    = is_array($var) ? implode(',', $var) : strval($var);
		$values = array_filter(explode(',', trim($var)));

		if ($settings['data_type'] == 'enum' and count($values) > 1)
		{
			throw new InvalidContentType('Enum cannot have more than 1 value.');
		}

		foreach ($values as $val)
		{
			if ( ! in_array($val, $settings['options']))
			{
				throw new InvalidContentType('Invalid value given for '.ucfirst($settings['data_type']).
					', value "'.$var.'" not in available options: "'.implode(', ', $settings['options']).'".');
			}
		}

		return $var;
	}
public static function type_set_before ( $ var , array $ settings ) { $ var = is_array ( $ var ) ? implode ( ',' , $ var ) : strval ( $ var ) ; $ values = array_filter ( explode ( ',' , trim ( $ var ) ) ) ; if ( $ settings [ 'data_type' ] == 'enum' and count ( $ values ) > 1 ) { throw new InvalidContentType ( 'Enum cannot have more than 1 value.' ) ; } foreach ( $ values as $ val ) { if ( ! in_array ( $ val , $ settings [ 'options' ] ) ) { throw new InvalidContentType ( 'Invalid value given for ' . ucfirst ( $ settings [ 'data_type' ] ) . ', value "' . $ var . '" not in available options: "' . implode ( ', ' , $ settings [ 'options' ] ) . '".' ) ; } } return $ var ; }
Value pre-treater, deals with array values, and handles the enum type

@param   mixed  value
@param   array  any options to be passed

@throws  InvalidContentType

@return  string
Value pre - treater deals with array values and handles the enum type