/** * @param integer|null $maxSize * @param integer $status * @param array $headers */ public function __construct($maxSize = null, $status = 409, array $headers = []) { parent::__construct('php://memory', $status, $headers); $body = $this->getBody(); $body->write("Conflict: The requested size is superior to the internal limit"); if ($maxSize !== null) { $body->write(" ({$maxSize})"); } }
/** * @param integer $size * @param string $content * @param integer $status * @param array $headers */ public function __construct($size, $content = '-', $status = 200, array $headers = []) { if (!is_int($size)) { throw new InvalidArgumentException('Size must be an integer'); } if (!is_string($content) || empty($content)) { throw new InvalidArgumentException('Content must be a non-empty string'); } // The response should never be cached $headers = array_merge(['Cache-Control' => 'no-cache, no-store, no-transform', 'Pragma' => 'no-cache'], $headers); parent::__construct('php://memory', $status, $headers); $this->fillBody($size, $content); }
/** * @param integer $status * @param array $headers */ public function __construct($status = 204, array $headers = []) { $body = new Stream('php://temp', 'r'); parent::__construct($body, $status, $headers); }