src/Neevo/Result.php
protected function convertType($value, $type){
		$dateFormat = $this->connection['result']['formatDate'];
		if($value === null)
			return null;
		switch($type){
			case Manager::TEXT:
				return (string) $value;

			case Manager::INT:
				return (int) $value;

			case Manager::FLOAT:
				return (float) $value;

			case Manager::BOOL:
				return ((bool) $value) && $value !== 'f' && $value !== 'F';

			case Manager::BINARY:
				return $this->connection->getDriver()->unescape($value, $type);

			case Manager::DATETIME:
				if((int) $value === 0)
					return null;
				elseif(!$dateFormat)
					return new DateTime(is_numeric($value) ? date('Y-m-d H:i:s', $value) : $value);
				elseif($dateFormat == 'U')
					return is_numeric($value) ? (int) $value : strtotime($value);
				elseif(is_numeric($value))
					return date($dateFormat, $value);
				else{
					$d = new DateTime($value);
					return $d->format($dateFormat);
				}

			default:
				return $value;
		}
	}
protected function convertType($value, $type){
		$dateFormat = $this->connection['result']['formatDate'];
		if($value === null)
			return null;
		switch($type){
			case Manager::TEXT:
				return (string) $value;

			case Manager::INT:
				return (int) $value;

			case Manager::FLOAT:
				return (float) $value;

			case Manager::BOOL:
				return ((bool) $value) && $value !== 'f' && $value !== 'F';

			case Manager::BINARY:
				return $this->connection->getDriver()->unescape($value, $type);

			case Manager::DATETIME:
				if((int) $value === 0)
					return null;
				elseif(!$dateFormat)
					return new DateTime(is_numeric($value) ? date('Y-m-d H:i:s', $value) : $value);
				elseif($dateFormat == 'U')
					return is_numeric($value) ? (int) $value : strtotime($value);
				elseif(is_numeric($value))
					return date($dateFormat, $value);
				else{
					$d = new DateTime($value);
					return $d->format($dateFormat);
				}

			default:
				return $value;
		}
	}
protected function convertType ( $ value , $ type ) { $ dateFormat = $ this -> connection [ 'result' ] [ 'formatDate' ] ; if ( $ value === null ) return null ; switch ( $ type ) { case Manager :: TEXT : return ( string ) $ value ; case Manager :: INT : return ( int ) $ value ; case Manager :: FLOAT : return ( float ) $ value ; case Manager :: BOOL : return ( ( bool ) $ value ) && $ value !== 'f' && $ value !== 'F' ; case Manager :: BINARY : return $ this -> connection -> getDriver ( ) -> unescape ( $ value , $ type ) ; case Manager :: DATETIME : if ( ( int ) $ value === 0 ) return null ; elseif ( ! $ dateFormat ) return new DateTime ( is_numeric ( $ value ) ? date ( 'Y-m-d H:i:s' , $ value ) : $ value ) ; elseif ( $ dateFormat == 'U' ) return is_numeric ( $ value ) ? ( int ) $ value : strtotime ( $ value ) ; elseif ( is_numeric ( $ value ) ) return date ( $ dateFormat , $ value ) ; else { $ d = new DateTime ( $ value ) ; return $ d -> format ( $ dateFormat ) ; } default : return $ value ; } }
Converts value to a specified type.
@param mixed $value
@param string $type
@return mixed
Converts value to a specified type .