code: public function parse(UriInterface $uri): ParsedURL
      {
          $matches = [];
          if(preg_match($this->pattern, $uri->getPath(), $matches) === 0) {
              throw new InvalidRequestURLException("Unable to parse request path: did not match regex");
          }
          if(!($endpoint = $matches["endpoint"] ?? null)) {
              throw new InvalidRequestURLException("Unable to match endpoint in url");
          }
          $element = $matches["element"] ?? null;
          $version = $matches["version"] ?? null;
          $apiKey = $matches["apiKey"] ?? null;
  
          $acceptableMimeTypes = [];
          if(($acceptableExtension = $matches["acceptableExtension"] ?? null)) {
              if(!$this->MIMEProvider) {
                  throw new UnableToParseURLException("Unable to accept acceptable extensions");
              } else {
                  try {
                      $acceptableMimeTypes[] = $this->MIMEProvider->provideMIME($acceptableExtension);
                  } catch (UnableToProvideMIMEException $exception) {
                      throw new UnableToParseURLException($exception->getMessage());
                  }
              }
          }
  
          return new ParsedURL($endpoint, $element, $version, $apiKey, $acceptableMimeTypes, $uri->getQuery());
      }
docs: Parses API request data out of a url
  @param UriInterface $uri
  @return ParsedURL
  @throws UnableToParseURLException
  @throws InvalidRequestURLException