/** * Creates a request message. * * @param string $method * @param null $target * @param array $headers * @param string $body */ public function __construct($method = self::METHOD_GET, $target = null, array $headers = [], $body = 'php://memory') { parent::__construct($body, $headers); $this->method = $method; $this->requestTarget = $target; $target = null === $target ? '' : $target; $this->uri = new Uri($target); }
/** * @param string|resource|StreamInterface $body Stream identifier and/or * actual stream resource * * @param int $status Status code for the response, if any. * @param array $headers Headers for the response, if any. * * @throws InvalidArgumentException on any invalid element. */ public function __construct($status = 200, array $headers = [], $body = 'php://memory') { parent::__construct($body, $headers); $this->setStatusCode($status); }