-
Notifications
You must be signed in to change notification settings - Fork 45
/
Header.php
63 lines (47 loc) · 1.21 KB
/
Header.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
/**
* Slim Framework (https://slimframework.com)
*
* @license https://github.com/slimphp/Slim-Psr7/blob/master/LICENSE.md (MIT License)
*/
declare(strict_types=1);
namespace Slim\Psr7;
use function array_merge;
use function is_string;
class Header
{
private string $originalName;
private string $normalizedName;
private array $values;
public function __construct(string $originalName, string $normalizedName, array $values)
{
$this->originalName = $originalName;
$this->normalizedName = $normalizedName;
$this->values = $values;
}
public function getOriginalName(): string
{
return $this->originalName;
}
public function getNormalizedName(): string
{
return $this->normalizedName;
}
public function addValue(string $value): self
{
$this->values[] = $value;
return $this;
}
public function addValues(array|string $values): self
{
if (is_string($values)) {
return $this->addValue($values);
}
$this->values = array_merge($this->values, $values);
return $this;
}
public function getValues(): array
{
return $this->values;
}
}