Total Complexity | 4 |
Total Lines | 27 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | class RedirectBucket extends DataBucket |
||
11 | { |
||
12 | protected ?string $location = null; |
||
13 | |||
14 | protected const IS_CONVERTABLE = false; |
||
15 | |||
16 | 11 | public function __construct(string $location, int $code = Status::FOUND) |
|
17 | { |
||
18 | 11 | parent::__construct(''); |
|
19 | 11 | $this->setLocation($location); |
|
20 | 11 | $this->setStatusCode($code); |
|
21 | 11 | } |
|
22 | 3 | public function getLocation(): ?string |
|
23 | { |
||
24 | 3 | return $this->location; |
|
25 | } |
||
26 | 2 | public function withLocation(?string $location): self |
|
27 | { |
||
28 | 2 | $new = clone $this; |
|
29 | 2 | $new->setLocation($location); |
|
30 | 2 | return $new; |
|
31 | } |
||
32 | |||
33 | 11 | protected function setLocation(?string $location): void |
|
37 | 11 | } |
|
38 | } |
||
39 |