original_string: protected function buildUrl($url, $query = [])
      {
          $url = explode('?', $url, 2);
          if (count($url) == 2) {
              parse_str($url[1], $query0);
              $query = array_merge($query0, $query);
          }
          $query['apikey'] = $this->key;
  
          $url = $url[0];
  
          if (strpos($url, $this->baseUrl) === false) {
              $url = $this->baseUrl . $url;
          }
  
          return $this->uriFactory->createUri($url)
              ->withQuery(http_build_query($query));
      }
code: protected function buildUrl($url, $query = [])
      {
          $url = explode('?', $url, 2);
          if (count($url) == 2) {
              parse_str($url[1], $query0);
              $query = array_merge($query0, $query);
          }
          $query['apikey'] = $this->key;
  
          $url = $url[0];
  
          if (strpos($url, $this->baseUrl) === false) {
              $url = $this->baseUrl . $url;
          }
  
          return $this->uriFactory->createUri($url)
              ->withQuery(http_build_query($query));
      }
code_tokens: protected function buildUrl ( $ url , $ query = [ ] ) { $ url = explode ( '?' , $ url , 2 ) ; if ( count ( $ url ) == 2 ) { parse_str ( $ url [ 1 ] , $ query0 ) ; $ query = array_merge ( $ query0 , $ query ) ; } $ query [ 'apikey' ] = $ this -> key ; $ url = $ url [ 0 ] ; if ( strpos ( $ url , $ this -> baseUrl ) === false ) { $ url = $ this -> baseUrl . $ url ; } return $ this -> uriFactory -> createUri ( $ url ) -> withQuery ( http_build_query ( $ query ) ) ; }
docstring: Extend an URL with query string parameters and return an UriInterface object.
  
  @param string $url
  @param array  $query
  
  @return UriInterface
docstring_tokens: Extend an URL with query string parameters and return an UriInterface object .