3 namespace Friendica\Module;
5 use Friendica\Capabilities\ICanReadAndWriteToResponds;
6 use Friendica\Capabilities\IRespondToRequests;
7 use Friendica\Network\HTTPException\InternalServerErrorException;
9 class Response implements ICanReadAndWriteToResponds
14 protected $headers = [];
18 protected $content = '';
22 protected $type = IRespondToRequests::TYPE_CONTENT;
27 public function addHeader(string $key, string $value)
29 $this->headers[$key][] = $value;
35 public function addContent(string $content)
37 $this->content .= $content;
43 public function getHeaders(): array
45 return $this->headers;
51 public function getContent(): string
53 return $this->content;
59 public function setType(string $type)
61 if (!in_array($type, IRespondToRequests::ALLOWED_TYPES)) {
62 throw new InternalServerErrorException('wrong type');
71 public function getTyp(): string