Beispiel #1
0
 /**
  * Response constructor.
  *
  * @param string $content
  * @param int $statusCode
  * @param array $headers
  */
 public function __construct($content = '', $statusCode = Response::HTTP_OK, array $headers = [])
 {
     $this->withBody(new Stream('php://memory', 'wb+'));
     $this->withStatus($statusCode);
     $this->withContent($content);
     parent::__construct(array_merge(static::HEADERS, $headers));
 }
Beispiel #2
0
 /**
  * Request constructor.
  *
  * @param $uri
  * @param array $headers
  * @param string $body
  */
 public function __construct($uri, array $headers = [], $body = 'php://memory')
 {
     $this->withUri(new Uri($uri));
     $this->withBody(new Stream($body));
     parent::__construct(array_merge(['USER_AGENT' => static::USER_AGENT], $headers));
 }