1 | <?php |
||
9 | final class Context implements JsonSerializable |
||
10 | { |
||
11 | /** |
||
12 | * @var mixed[]|null |
||
13 | */ |
||
14 | private $custom; |
||
15 | |||
16 | /** |
||
17 | * @var Response|null |
||
18 | */ |
||
19 | private $response; |
||
20 | |||
21 | /** |
||
22 | * @var Request|null |
||
23 | */ |
||
24 | private $request; |
||
25 | |||
26 | /** |
||
27 | * @var string[] |
||
28 | */ |
||
29 | private $tagList = []; |
||
30 | |||
31 | /** |
||
32 | * @var User|null |
||
33 | */ |
||
34 | private $user; |
||
35 | |||
36 | /** |
||
37 | * @param mixed $value |
||
38 | */ |
||
39 | 1 | public function withCustomVariable(string $name, $value): self |
|
46 | |||
47 | 1 | public function withResponse(Response $response): self |
|
48 | { |
||
49 | 1 | $me = clone $this; |
|
50 | 1 | $me->response = $response; |
|
51 | |||
52 | 1 | return $me; |
|
53 | } |
||
54 | |||
55 | 13 | public function withRequest(Request $request): self |
|
62 | |||
63 | 37 | public function withTag(string $tag, string $value): self |
|
70 | |||
71 | 1 | public function withUser(User $user): self |
|
72 | { |
||
73 | 1 | $me = clone $this; |
|
74 | 1 | $me->user = $user; |
|
75 | |||
76 | 1 | return $me; |
|
77 | } |
||
78 | |||
79 | /** |
||
80 | * @return mixed[] |
||
81 | */ |
||
82 | 46 | public function jsonSerialize(): array |
|
92 | } |
||
93 |