/** * Return the resolve URI with a updated path and query * * @param LeagueUriInterface|UriInterface $relative the relative URI * @param string $pathString the relative path string * @param string $queryString the relative query string * * @return LeagueUriInterface|UriInterface */ protected function resolveRelativePath($relative, $pathString, $queryString) { $relativePath = new HierarchicalPath($pathString); if ($relativePath->isAbsolute()) { return $this->getBaseUri($relative)->withPath($relativePath->__toString())->withQuery($queryString); } $originalUri = $relativePath->modify($this->uri->getPath()); $segments = $originalUri->toArray(); array_pop($segments); $isAbsolute = HierarchicalPath::IS_RELATIVE; if (empty($originalUri->__toString()) || $originalUri->isAbsolute()) { $isAbsolute = HierarchicalPath::IS_ABSOLUTE; } $relativePath = $relativePath->createFromArray(array_merge($segments, $relativePath->toArray()), $isAbsolute); return $this->getBaseUri($relative)->withPath($relativePath->__toString())->withQuery($queryString); }