src/Utility/Utility.php
public static function typeCast($value, $type) {
		switch ($type) {
			case 'int':
				$value = (int)$value;
				break;
			case 'float':
				$value = (float)$value;
				break;
			case 'double':
				$value = (double)$value;
				break;
			case 'array':
				$value = (array)$value;
				break;
			case 'bool':
				$value = (bool)$value;
				break;
			case 'string':
				$value = (string)$value;
				break;
			default:
				return null;
		}
		return $value;
	}
public static function typeCast($value, $type) {
		switch ($type) {
			case 'int':
				$value = (int)$value;
				break;
			case 'float':
				$value = (float)$value;
				break;
			case 'double':
				$value = (double)$value;
				break;
			case 'array':
				$value = (array)$value;
				break;
			case 'bool':
				$value = (bool)$value;
				break;
			case 'string':
				$value = (string)$value;
				break;
			default:
				return null;
		}
		return $value;
	}
public static function typeCast ( $ value , $ type ) { switch ( $ type ) { case 'int' : $ value = ( int ) $ value ; break ; case 'float' : $ value = ( float ) $ value ; break ; case 'double' : $ value = ( double ) $ value ; break ; case 'array' : $ value = ( array ) $ value ; break ; case 'bool' : $ value = ( bool ) $ value ; break ; case 'string' : $ value = ( string ) $ value ; break ; default : return null ; } return $ value ; }
Convenience function for automatic casting in form methods etc.

@param mixed $value
@param string $type
@return mixed Safe value for DB query, or NULL if type was not a valid one
Convenience function for automatic casting in form methods etc .