public function generate(array $components)
    {
        $uri = $components['scheme'] . '://'
             . $components['authority']
             . $components['path'];

        if (array_key_exists('query', $components) && strlen($components['query'])) {
            $uri .= '?' . $components['query'];
        }
        if (array_key_exists('fragment', $components)) {
            $uri .= '#' . $components['fragment'];
        }

        return $uri;
    }
public function generate(array $components)
    {
        $uri = $components['scheme'] . '://'
             . $components['authority']
             . $components['path'];

        if (array_key_exists('query', $components) && strlen($components['query'])) {
            $uri .= '?' . $components['query'];
        }
        if (array_key_exists('fragment', $components)) {
            $uri .= '#' . $components['fragment'];
        }

        return $uri;
    }
public function generate ( array $ components ) { $ uri = $ components [ 'scheme' ] . '://' . $ components [ 'authority' ] . $ components [ 'path' ] ; if ( array_key_exists ( 'query' , $ components ) && strlen ( $ components [ 'query' ] ) ) { $ uri .= '?' . $ components [ 'query' ] ; } if ( array_key_exists ( 'fragment' , $ components ) ) { $ uri .= '#' . $ components [ 'fragment' ] ; } return $ uri ; }
Builds a URI based on n array with the main components

@param array $components

@return string
Builds a URI based on n array with the main components