original_string: protected static function flatten( $routes, $param_prefix = '' ) 
  	{
  		
  		$flattened = array();
  		
  		foreach( $routes as $prefix => $route ) 
  		{
  			if ( is_array( $route ) && !is_callable( $route ) ) 
  			{
  				$flattened = array_merge( static::flatten( $route, $param_prefix.$prefix.'/' ), $flattened );
  			} 
  			else 
  			{
  				if ( $prefix == '/' ) 
  				{
  					$prefix = ''; $param_prefix = substr( $param_prefix, 0, -1 );
  					$flattened[$param_prefix.$prefix] = $route;
  					$param_prefix.= '/';
  				} 
  				else 
  				{
  					$flattened[$param_prefix.$prefix] = $route;
  				}
  			}
  		}
  		
  		return $flattened;
  	}
code: protected static function flatten( $routes, $param_prefix = '' ) 
  	{
  		
  		$flattened = array();
  		
  		foreach( $routes as $prefix => $route ) 
  		{
  			if ( is_array( $route ) && !is_callable( $route ) ) 
  			{
  				$flattened = array_merge( static::flatten( $route, $param_prefix.$prefix.'/' ), $flattened );
  			} 
  			else 
  			{
  				if ( $prefix == '/' ) 
  				{
  					$prefix = ''; $param_prefix = substr( $param_prefix, 0, -1 );
  					$flattened[$param_prefix.$prefix] = $route;
  					$param_prefix.= '/';
  				} 
  				else 
  				{
  					$flattened[$param_prefix.$prefix] = $route;
  				}
  			}
  		}
  		
  		return $flattened;
  	}
code_tokens: protected static function flatten ( $ routes , $ param_prefix = '' ) { $ flattened = array ( ) ; foreach ( $ routes as $ prefix => $ route ) { if ( is_array ( $ route ) && ! is_callable ( $ route ) ) { $ flattened = array_merge ( static :: flatten ( $ route , $ param_prefix . $ prefix . '/' ) , $ flattened ) ; } else { if ( $ prefix == '/' ) { $ prefix = '' ; $ param_prefix = substr ( $ param_prefix , 0 , - 1 ) ; $ flattened [ $ param_prefix . $ prefix ] = $ route ; $ param_prefix .= '/' ; } else { $ flattened [ $ param_prefix . $ prefix ] = $ route ; } } } return $ flattened ; }
docstring: Flatten the routes
  
  @param array		$routes
  @param string		$param_prefix
  @return array
docstring_tokens: Flatten the routes