/** * Converts an raw http request into an PSX\Http\Request object * * @param string $content * @return \PSX\Http\Request */ public function parse($content) { $content = $this->normalize($content); list($method, $path, $scheme) = $this->getStatus($content); // resolve uri path if ($this->baseUrl !== null) { $path = UriResolver::resolve($this->baseUrl, new Uri($path)); } else { $path = new Uri($path); } $request = new Request($path, $method); $request->setProtocolVersion($scheme); list($header, $body) = $this->splitMessage($content); $this->headerToArray($request, $header); $request->setBody(new StringStream($body)); return $request; }