original_string: public static function to( $uri = '', $params = array(), $retain = false ) 
  	{
  		// To avoid // urls we check for a single slash.
  		if ( $uri === '/' ) 
  		{
  			$uri = '';
  		}
  
  		// When the uri starts with an @ sign we handle the uri as route alias.
  		if ( substr( $uri, 0, 1 ) == '@' ) 
  		{
  			return static::alias( substr( $uri, 1 ), $params, $retain );
  		}
  
  		// Are there already parameters in the uri? Parse them
  		// and merge them with current argument parameters
  		if ( strpos( $uri, '?' ) !== false )
  		{
  			$parts = explode( '?', $uri );
  
  			$uri = $parts[0];
  
  			if ( isset( $parts[1] ) )
  			{
  				parse_str( $parts[1], $old_params );
  
  				$params = array_merge( $old_params, $params );
  			}
  		}
  
  
  		// When the uri contains a protocoll or starts with a slash we assume
  		// a full url is given and we don't have to add a path offest.
  		if ( strpos( $uri, '://' ) === false && substr( $uri, 0, 1 ) !== '/' ) 
  		{
  			$uri = static::$path_offset.$uri;
  		}
  
  
  		// Try to replace parameters in the uri and remove them from
  		// the array so we can append them as get parameters
  		foreach( $params as $key => $value )
  		{
  			// replace the parameter provider
  			if ( is_numeric( $key ) && is_string($value) && $value[0] === ':' )
  			{
  				$param_provider_key = substr( $value, 1 );
  
  				// remove the parameter provider from the parameter list
  				unset( $params[$key] );
  
  				if ( array_key_exists( $param_provider_key, static::$parameter_provider ) )
  				{
  					$params = $params + call_user_func( static::$parameter_provider[$param_provider_key] );
  				}
  			}
  
  			// replace the parameters
  			if ( !is_array($value))
  			{
  				$uri = str_replace( ':'.$key, $value, $uri, $count );
  
  				if ( $count > 0 )
  				{
  					unset( $params[$key] );
  				}
  			}
  		}
  
  		// Should we keep the get parameters? If retain is enabled
  		// we merge the get parameter array with argument parameters
  		if ( $retain )
  		{
  			$params = array_merge( CCIn::$_instance->GET, $params );
  		}
  
  		// When we still got parameters add them to the url
  		if ( !empty( $params ) ) 
  		{
  			$uri .= '?'.http_build_query( $params );
  		}
  
  		return $uri;
  	}
code: public static function to( $uri = '', $params = array(), $retain = false ) 
  	{
  		// To avoid // urls we check for a single slash.
  		if ( $uri === '/' ) 
  		{
  			$uri = '';
  		}
  
  		// When the uri starts with an @ sign we handle the uri as route alias.
  		if ( substr( $uri, 0, 1 ) == '@' ) 
  		{
  			return static::alias( substr( $uri, 1 ), $params, $retain );
  		}
  
  		// Are there already parameters in the uri? Parse them
  		// and merge them with current argument parameters
  		if ( strpos( $uri, '?' ) !== false )
  		{
  			$parts = explode( '?', $uri );
  
  			$uri = $parts[0];
  
  			if ( isset( $parts[1] ) )
  			{
  				parse_str( $parts[1], $old_params );
  
  				$params = array_merge( $old_params, $params );
  			}
  		}
  
  
  		// When the uri contains a protocoll or starts with a slash we assume
  		// a full url is given and we don't have to add a path offest.
  		if ( strpos( $uri, '://' ) === false && substr( $uri, 0, 1 ) !== '/' ) 
  		{
  			$uri = static::$path_offset.$uri;
  		}
  
  
  		// Try to replace parameters in the uri and remove them from
  		// the array so we can append them as get parameters
  		foreach( $params as $key => $value )
  		{
  			// replace the parameter provider
  			if ( is_numeric( $key ) && is_string($value) && $value[0] === ':' )
  			{
  				$param_provider_key = substr( $value, 1 );
  
  				// remove the parameter provider from the parameter list
  				unset( $params[$key] );
  
  				if ( array_key_exists( $param_provider_key, static::$parameter_provider ) )
  				{
  					$params = $params + call_user_func( static::$parameter_provider[$param_provider_key] );
  				}
  			}
  
  			// replace the parameters
  			if ( !is_array($value))
  			{
  				$uri = str_replace( ':'.$key, $value, $uri, $count );
  
  				if ( $count > 0 )
  				{
  					unset( $params[$key] );
  				}
  			}
  		}
  
  		// Should we keep the get parameters? If retain is enabled
  		// we merge the get parameter array with argument parameters
  		if ( $retain )
  		{
  			$params = array_merge( CCIn::$_instance->GET, $params );
  		}
  
  		// When we still got parameters add them to the url
  		if ( !empty( $params ) ) 
  		{
  			$uri .= '?'.http_build_query( $params );
  		}
  
  		return $uri;
  	}
code_tokens: public static function to ( $ uri = '' , $ params = array ( ) , $ retain = false ) { // To avoid // urls we check for a single slash. if ( $ uri === '/' ) { $ uri = '' ; } // When the uri starts with an @ sign we handle the uri as route alias. if ( substr ( $ uri , 0 , 1 ) == '@' ) { return static :: alias ( substr ( $ uri , 1 ) , $ params , $ retain ) ; } // Are there already parameters in the uri? Parse them // and merge them with current argument parameters if ( strpos ( $ uri , '?' ) !== false ) { $ parts = explode ( '?' , $ uri ) ; $ uri = $ parts [ 0 ] ; if ( isset ( $ parts [ 1 ] ) ) { parse_str ( $ parts [ 1 ] , $ old_params ) ; $ params = array_merge ( $ old_params , $ params ) ; } } // When the uri contains a protocoll or starts with a slash we assume // a full url is given and we don't have to add a path offest. if ( strpos ( $ uri , '://' ) === false && substr ( $ uri , 0 , 1 ) !== '/' ) { $ uri = static :: $ path_offset . $ uri ; } // Try to replace parameters in the uri and remove them from // the array so we can append them as get parameters foreach ( $ params as $ key => $ value ) { // replace the parameter provider if ( is_numeric ( $ key ) && is_string ( $ value ) && $ value [ 0 ] === ':' ) { $ param_provider_key = substr ( $ value , 1 ) ; // remove the parameter provider from the parameter list unset ( $ params [ $ key ] ) ; if ( array_key_exists ( $ param_provider_key , static :: $ parameter_provider ) ) { $ params = $ params + call_user_func ( static :: $ parameter_provider [ $ param_provider_key ] ) ; } } // replace the parameters if ( ! is_array ( $ value ) ) { $ uri = str_replace ( ':' . $ key , $ value , $ uri , $ count ) ; if ( $ count > 0 ) { unset ( $ params [ $ key ] ) ; } } } // Should we keep the get parameters? If retain is enabled // we merge the get parameter array with argument parameters if ( $ retain ) { $ params = array_merge ( CCIn :: $ _instance -> GET , $ params ) ; } // When we still got parameters add them to the url if ( ! empty ( $ params ) ) { $ uri .= '?' . http_build_query ( $ params ) ; } return $ uri ; }
docstring: Generate an url
  
  @param string			$uri
  @param array			$params
  @param bool			$retain		Should we keep the get parameters?
  @return string
docstring_tokens: Generate an url