index/src/Http/HttpHeader.php

34 lines
668 B
PHP

<?php
// HttpHeader.php
// Created: 2022-02-14
// Updated: 2022-02-27
namespace Index\Http;
use Stringable;
class HttpHeader implements Stringable {
private string $name;
private array $lines;
public function __construct(string $name, string ...$lines) {
$this->name = $name;
$this->lines = $lines;
}
public function getName(): string {
return $this->name;
}
public function getLines(): array {
return $this->lines;
}
public function getFirstLine(): string {
return $this->lines[0];
}
public function __toString(): string {
return implode(', ', $this->lines);
}
}