1 | <?php |
||
21 | class Kernel |
||
22 | { |
||
23 | public const VERSION = '1.0.0'; |
||
24 | |||
25 | /** @var Kernel */ |
||
26 | protected static $instance; |
||
27 | |||
28 | private $container; |
||
29 | |||
30 | /** @var Context|null */ |
||
31 | private $context; |
||
32 | |||
33 | 6 | public function __construct(Container $container) |
|
37 | |||
38 | /** |
||
39 | * Get current channel. |
||
40 | * |
||
41 | * @return Channel |
||
42 | * |
||
43 | * @throws \Psr\Container\ContainerExceptionInterface |
||
44 | */ |
||
45 | public function getChannel(): Channel |
||
49 | |||
50 | /** |
||
51 | * Get current driver instance. |
||
52 | * |
||
53 | * @return Driver |
||
54 | * |
||
55 | * @throws \Psr\Container\ContainerExceptionInterface |
||
56 | */ |
||
57 | 1 | public function getDriver(): Driver |
|
61 | |||
62 | /** |
||
63 | * Get context instance. |
||
64 | * |
||
65 | * @return Context|null |
||
66 | */ |
||
67 | 2 | public function getContext(): ?Context |
|
71 | |||
72 | /** |
||
73 | * Set context instance. |
||
74 | * |
||
75 | * @param Context $context |
||
76 | */ |
||
77 | 2 | public function setContext(Context $context): void |
|
81 | |||
82 | /** |
||
83 | * Clear context. |
||
84 | * |
||
85 | * @throws \Psr\Container\ContainerExceptionInterface |
||
86 | */ |
||
87 | 1 | public function clearContext(): void |
|
94 | |||
95 | /** |
||
96 | * Resolve from container. |
||
97 | * |
||
98 | * @param string $class |
||
99 | * |
||
100 | * @return mixed |
||
101 | * @throws \Psr\Container\ContainerExceptionInterface |
||
102 | */ |
||
103 | 5 | public function resolve(string $class) |
|
107 | |||
108 | /** |
||
109 | * Process webhook request. |
||
110 | * |
||
111 | * @param Channel $channel |
||
112 | * @param ServerRequestInterface $request |
||
113 | * |
||
114 | * @return mixed |
||
115 | * |
||
116 | * @throws \Psr\Container\ContainerExceptionInterface |
||
117 | * @throws \FondBot\Drivers\Exceptions\DriverNotFound |
||
118 | */ |
||
119 | 4 | public function process(Channel $channel, ServerRequestInterface $request) |
|
157 | |||
158 | /** |
||
159 | * Start conversation. |
||
160 | * |
||
161 | * @param Conversable $conversable |
||
162 | */ |
||
163 | 2 | public function converse(Conversable $conversable): void |
|
175 | |||
176 | /** |
||
177 | * Get driver manager. |
||
178 | * |
||
179 | * @return DriverManager |
||
180 | * |
||
181 | * @throws \Psr\Container\ContainerExceptionInterface |
||
182 | */ |
||
183 | 4 | private function driverManager(): DriverManager |
|
187 | |||
188 | /** |
||
189 | * Get context manager. |
||
190 | * |
||
191 | * @return ContextManager |
||
192 | * |
||
193 | * @throws \Psr\Container\ContainerExceptionInterface |
||
194 | */ |
||
195 | 3 | private function contextManager(): ContextManager |
|
199 | |||
200 | /** |
||
201 | * Get intent manager. |
||
202 | * |
||
203 | * @return IntentManager |
||
204 | * |
||
205 | * @throws \Psr\Container\ContainerExceptionInterface |
||
206 | */ |
||
207 | 1 | private function intentManager(): IntentManager |
|
211 | } |
||
212 |