1 | <?php |
||
23 | final class View |
||
24 | { |
||
25 | private $data; |
||
26 | private $statusCode; |
||
27 | private $format; |
||
28 | private $location; |
||
29 | private $route; |
||
30 | private $routeParameters; |
||
31 | private $context; |
||
32 | private $response; |
||
33 | |||
34 | 9 | public static function create($data = null, ?int $statusCode = null, array $headers = []): self |
|
38 | |||
39 | 1 | public static function createRedirect(string $url, int $statusCode = Response::HTTP_FOUND, array $headers = []): self |
|
46 | |||
47 | 2 | public static function createRouteRedirect( |
|
59 | |||
60 | 58 | public function __construct($data = null, ?int $statusCode = null, array $headers = []) |
|
69 | |||
70 | 58 | public function setData($data): self |
|
76 | |||
77 | public function setHeader(string $name, string $value): self |
||
83 | |||
84 | 2 | public function setHeaders(array $headers): self |
|
90 | |||
91 | 58 | public function setStatusCode(?int $code): self |
|
99 | |||
100 | public function setContext(Context $context): self |
||
106 | |||
107 | 24 | public function setFormat(string $format): self |
|
113 | |||
114 | 4 | public function setLocation(string $location): self |
|
121 | |||
122 | /** |
||
123 | * Sets the route (implicitly removes the location). |
||
124 | */ |
||
125 | 3 | public function setRoute(string $route): self |
|
132 | |||
133 | 3 | public function setRouteParameters(array $parameters): self |
|
139 | |||
140 | public function setResponse(Response $response): self |
||
146 | |||
147 | 43 | public function getData() |
|
151 | |||
152 | 53 | public function getStatusCode(): ?int |
|
156 | |||
157 | public function getHeaders(): array |
||
161 | |||
162 | 29 | public function getFormat(): ?string |
|
166 | |||
167 | 41 | public function getLocation(): ?string |
|
171 | |||
172 | 43 | public function getRoute(): ?string |
|
176 | |||
177 | 2 | public function getRouteParameters(): ?array |
|
181 | |||
182 | 47 | public function getResponse(): Response |
|
194 | |||
195 | 38 | public function getContext(): Context |
|
203 | } |
||
204 |