| 1 | <?php |
||
| 7 | class TelegramRawData |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Nothing is done so far with this, but it's always a good idea to have the original around |
||
| 11 | * @var string |
||
| 12 | */ |
||
| 13 | private $rawData = ''; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * The actual representation of the decoded data |
||
| 17 | * @var array |
||
| 18 | */ |
||
| 19 | private $decodedData = []; |
||
| 20 | |||
| 21 | 17 | public function __construct(string $rawData) |
|
| 26 | |||
| 27 | /** |
||
| 28 | * To quickly find out what type of request we are dealing with |
||
| 29 | * |
||
| 30 | * Unused so far |
||
| 31 | * |
||
| 32 | * @return string |
||
| 33 | */ |
||
| 34 | public function getTypeOfResult(): string |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Most of the requests Telegram sends, come as an array, so send the response back as an array by default |
||
| 51 | * |
||
| 52 | * @return array |
||
| 53 | */ |
||
| 54 | 15 | public function getResult(): array |
|
| 58 | |||
| 59 | /** |
||
| 60 | * Hack: for some requests Telegram sends back an array, integer or a boolean value, convert it to boolean here |
||
| 61 | * @return bool |
||
| 62 | */ |
||
| 63 | 2 | public function getResultBoolean(): bool |
|
| 67 | |||
| 68 | /** |
||
| 69 | * Hack: for some requests Telegram send back an array, integer or a boolean value, convert it to int here |
||
| 70 | * @return int |
||
| 71 | */ |
||
| 72 | public function getResultInt(): int |
||
| 76 | } |
||
| 77 |