1 | <?php |
||
13 | class Context implements Arrayable |
||
14 | { |
||
15 | private $channel; |
||
16 | private $chat; |
||
17 | private $user; |
||
18 | private $intent; |
||
19 | private $interaction; |
||
20 | private $items; |
||
21 | |||
22 | 3 | public function __construct(Channel $channel, Chat $chat, User $user, array $items = []) |
|
29 | |||
30 | /** |
||
31 | * Get channel. |
||
32 | * |
||
33 | * @return Channel |
||
34 | */ |
||
35 | 1 | public function getChannel(): Channel |
|
39 | |||
40 | /** |
||
41 | * Get chat. |
||
42 | * |
||
43 | * @return Chat |
||
44 | */ |
||
45 | 1 | public function getChat(): Chat |
|
49 | |||
50 | /** |
||
51 | * Get user. |
||
52 | * |
||
53 | * @return User |
||
54 | */ |
||
55 | 1 | public function getUser(): User |
|
59 | |||
60 | /** |
||
61 | * Get current intent. |
||
62 | * |
||
63 | * @return Intent|Conversable|null |
||
64 | */ |
||
65 | 1 | public function getIntent(): ?Intent |
|
69 | |||
70 | /** |
||
71 | * Set intent. |
||
72 | * |
||
73 | * @param Intent $intent |
||
74 | */ |
||
75 | public function setIntent(Intent $intent): void |
||
79 | |||
80 | /** |
||
81 | * Get interaction. |
||
82 | * |
||
83 | * @return Interaction|Conversable|null |
||
84 | */ |
||
85 | 1 | public function getInteraction(): ?Interaction |
|
89 | |||
90 | /** |
||
91 | * Set interaction. |
||
92 | * |
||
93 | * @param Interaction|null $interaction |
||
94 | */ |
||
95 | public function setInteraction(?Interaction $interaction): void |
||
99 | |||
100 | /** |
||
101 | * Get item. |
||
102 | * |
||
103 | * @param string $key |
||
104 | * @param null $default |
||
105 | * |
||
106 | * @return mixed |
||
107 | */ |
||
108 | 3 | public function get(string $key, $default = null) |
|
112 | |||
113 | /** |
||
114 | * Set item. |
||
115 | * |
||
116 | * @param string $key |
||
117 | * @param mixed $value |
||
118 | */ |
||
119 | 2 | public function set(string $key, $value): void |
|
123 | |||
124 | /** |
||
125 | * Get the instance as an array. |
||
126 | * |
||
127 | * @return array |
||
128 | */ |
||
129 | 1 | public function toArray(): array |
|
137 | } |
||
138 |