/** * @param string $url * * @return Request */ private function getRequest($url) { if ($this->baseUri && substr($url, 0, 1) != '/') { throw new \InvalidArgumentException(sprintf("Invalid uri '%s' with baseUri '%s'", $url, $this->baseUri->get(false))); } if ($this->baseUri && $url) { $uri = clone $this->baseUri; $uri->setPath($uri->getPath() . $url); } else { $uri = $url instanceof Uri ? $url : new Uri($url); } return new Request($uri); }