httpCode = $httpCode; } /** * @param string $expires * * @return $this * * @since 21.0.0 */ public function setExpires(string $expires): self { $this->expires = $expires; return $this; } public function setHttpCode(int $httpCode): self { $this->httpCode = $httpCode; return $this; } /** * Add a link * * @param string $rel * @param string $template * * @return XrdResponse */ public function addLink(string $rel, string $template): self { $this->links[] = [ 'rel' => $rel, 'template' => $template ]; return $this; } public function toHttpResponse(): Response { $data = []; $data[] = ''; $data[] = ''; foreach ($this->links as $link) { $data[] = ' '; } $data[] = ''; $response = new TextPlainResponse(implode("\n", $data) . "\n", $this->httpCode); $response->addHeader('Content-Type', 'application/xrd+xml'); // overwrite default header return $response; } }