original_string: private function getPathFromUri($uri)
      {
          $uriParser = new UriParser($uri);
          // Prepare uri
          $uriParser->encode();
          $uri = $uriParser->stripFragment();
          if (strpos($uri, '/') === 0) {
              // URI is already an path
              return $uri;
          }
          if (!$uriParser->validate()) {
              throw new \InvalidArgumentException('Invalid URI');
          }
          $path = (($path = parse_url($uri, PHP_URL_PATH)) === null) ? '/' : $path;
          $query = (($query = parse_url($uri, PHP_URL_QUERY)) === null) ? '' : '?' . $query;
          return $path . $query;
      }
code: private function getPathFromUri($uri)
      {
          $uriParser = new UriParser($uri);
          // Prepare uri
          $uriParser->encode();
          $uri = $uriParser->stripFragment();
          if (strpos($uri, '/') === 0) {
              // URI is already an path
              return $uri;
          }
          if (!$uriParser->validate()) {
              throw new \InvalidArgumentException('Invalid URI');
          }
          $path = (($path = parse_url($uri, PHP_URL_PATH)) === null) ? '/' : $path;
          $query = (($query = parse_url($uri, PHP_URL_QUERY)) === null) ? '' : '?' . $query;
          return $path . $query;
      }
code_tokens: private function getPathFromUri ( $ uri ) { $ uriParser = new UriParser ( $ uri ) ; // Prepare uri $ uriParser -> encode ( ) ; $ uri = $ uriParser -> stripFragment ( ) ; if ( strpos ( $ uri , '/' ) === 0 ) { // URI is already an path return $ uri ; } if ( ! $ uriParser -> validate ( ) ) { throw new \ InvalidArgumentException ( 'Invalid URI' ) ; } $ path = ( ( $ path = parse_url ( $ uri , PHP_URL_PATH ) ) === null ) ? '/' : $ path ; $ query = ( ( $ query = parse_url ( $ uri , PHP_URL_QUERY ) ) === null ) ? '' : '?' . $ query ; return $ path . $ query ; }
docstring: Get path and query
  
  @param string $uri
  @return string
  @throws \InvalidArgumentException
docstring_tokens: Get path and query