public function cast ($name, $val)
	{
		
		// Ignore if value is null
		
		if (is_null ($val))
		{
			return $val;
		}
		
		// Cast value based upon attribute datatype
		
		switch (@static::$attributes[$name]['type'])
		{
			
			case self::TYPE_INT:
				$val	= (int)$val;
				break;
			
			case self::TYPE_STRING:
				$val	= (string)$val;
				break;
			
			case self::TYPE_BOOL:
				$val	= (bool)$val;
				break;
			
			case self::TYPE_DECIMAL:
				$val	= (float)$val;
				break;
			
			case self::TYPE_BINARY:
				$val	= (binary)$val;
				break;
			
		}
		
		// Return casted value
		
		return $val;
		
	}
public function cast ($name, $val)
	{
		
		// Ignore if value is null
		
		if (is_null ($val))
		{
			return $val;
		}
		
		// Cast value based upon attribute datatype
		
		switch (@static::$attributes[$name]['type'])
		{
			
			case self::TYPE_INT:
				$val	= (int)$val;
				break;
			
			case self::TYPE_STRING:
				$val	= (string)$val;
				break;
			
			case self::TYPE_BOOL:
				$val	= (bool)$val;
				break;
			
			case self::TYPE_DECIMAL:
				$val	= (float)$val;
				break;
			
			case self::TYPE_BINARY:
				$val	= (binary)$val;
				break;
			
		}
		
		// Return casted value
		
		return $val;
		
	}
public function cast ( $ name , $ val ) { // Ignore if value is null if ( is_null ( $ val ) ) { return $ val ; } // Cast value based upon attribute datatype switch ( @ static :: $ attributes [ $ name ] [ 'type' ] ) { case self :: TYPE_INT : $ val = ( int ) $ val ; break ; case self :: TYPE_STRING : $ val = ( string ) $ val ; break ; case self :: TYPE_BOOL : $ val = ( bool ) $ val ; break ; case self :: TYPE_DECIMAL : $ val = ( float ) $ val ; break ; case self :: TYPE_BINARY : $ val = ( binary ) $ val ; break ; } // Return casted value return $ val ; }
Cast a value for an attribute datatype
@param string $name Attribute name
@param mixed $val Value to cast
@return mixed
Cast a value for an attribute datatype