src/QueryBuilder.php
protected function _checkType($value, $type){

		// Integers and floats are allowed be NULL

		if($value === null && $type != 'bool'){

			return true;
		}

		switch($type){

			case 'int':

				$reducer = function($result, $value){

					if(!is_int($value)){

						$result = false;
					}

					return $result;
				};

			break;

			case 'float':

				$reducer = function($result, $value){

					if(!is_float($value)){

						$result = false;
					}

					return $result;
				};

			break;

			case 'bool':

				$reducer = function($result, $value){

					if(!is_bool($value)){

						$result = false;
					}

					return $result;
				};

			break;

			default:

				ExceptionHandler::notice("Invalid property type $type");

				return false;
		}

		if(is_array($value)){

			$result = array_reduce($value, $reducer, true);
		}
		else{

			$result = $reducer(true, $value);
		}

		return $result;
	}
protected function _checkType($value, $type){

		// Integers and floats are allowed be NULL

		if($value === null && $type != 'bool'){

			return true;
		}

		switch($type){

			case 'int':

				$reducer = function($result, $value){

					if(!is_int($value)){

						$result = false;
					}

					return $result;
				};

			break;

			case 'float':

				$reducer = function($result, $value){

					if(!is_float($value)){

						$result = false;
					}

					return $result;
				};

			break;

			case 'bool':

				$reducer = function($result, $value){

					if(!is_bool($value)){

						$result = false;
					}

					return $result;
				};

			break;

			default:

				ExceptionHandler::notice("Invalid property type $type");

				return false;
		}

		if(is_array($value)){

			$result = array_reduce($value, $reducer, true);
		}
		else{

			$result = $reducer(true, $value);
		}

		return $result;
	}
protected function _checkType ( $ value , $ type ) { // Integers and floats are allowed be NULL if ( $ value === null && $ type != 'bool' ) { return true ; } switch ( $ type ) { case 'int' : $ reducer = function ( $ result , $ value ) { if ( ! is_int ( $ value ) ) { $ result = false ; } return $ result ; } ; break ; case 'float' : $ reducer = function ( $ result , $ value ) { if ( ! is_float ( $ value ) ) { $ result = false ; } return $ result ; } ; break ; case 'bool' : $ reducer = function ( $ result , $ value ) { if ( ! is_bool ( $ value ) ) { $ result = false ; } return $ result ; } ; break ; default : ExceptionHandler :: notice ( "Invalid property type $type" ) ; return false ; } if ( is_array ( $ value ) ) { $ result = array_reduce ( $ value , $ reducer , true ) ; } else { $ result = $ reducer ( true , $ value ) ; } return $ result ; }
Check the type of the provided value.

<p>Checks whether the provided {@link $value} is of the provided {@link
$type}. When {@link $value} is an array the check is performed on all
elements of the array. The check fails if any of the array-elements (or
the value itself) are not of the specified type.</p>

@param mixed $value
@param string $type [int|float|bool]
@return boolean
Check the type of the provided value .