protected function resolvePathAndQuery(string $path, string $query): array
    {
        $components = ['path' => $path, 'query' => $query];

        if ('' === $components['path']) {
            $components['path'] = $this->base_uri->getPath();
            if ('' === $components['query']) {
                $components['query'] = $this->base_uri->getQuery();
            }

            return $components;
        }

        if (0 !== strpos($components['path'], '/')) {
            $components['path'] = $this->mergePath($components['path']);
        }

        return $components;
    }