| 1 | <?php |
||
| 10 | trait InteractsWithContext |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * Get chat. |
||
| 14 | * |
||
| 15 | * @return Chat |
||
| 16 | */ |
||
| 17 | protected function getChat(): Chat |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Get user. |
||
| 24 | * |
||
| 25 | * @return User |
||
| 26 | */ |
||
| 27 | protected function getUser(): User |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Get the whole context or a single value. |
||
| 34 | * |
||
| 35 | * @param string|null $key |
||
| 36 | * @param mixed $default |
||
| 37 | * |
||
| 38 | * @return array|mixed |
||
| 39 | */ |
||
| 40 | 2 | protected function context(string $key = null, $default = null) |
|
| 50 | |||
| 51 | /** |
||
| 52 | * Remember value in context. |
||
| 53 | * |
||
| 54 | * @param string $key |
||
| 55 | * @param mixed $value |
||
| 56 | */ |
||
| 57 | 1 | protected function remember(string $key, $value): void |
|
| 63 | } |
||
| 64 |