1 | <?php |
||
7 | class FormConstructor |
||
8 | { |
||
9 | /** |
||
10 | * @param TelegramMethods $method |
||
11 | * @return mixed |
||
12 | */ |
||
13 | public function constructFormData(TelegramMethods $method): array |
||
33 | |||
34 | /** |
||
35 | * Can perform any special checks needed to be performed before sending the actual request to Telegram |
||
36 | * |
||
37 | * This will return an array with data that will be different in each case (for now). This can be changed in the |
||
38 | * future. |
||
39 | * |
||
40 | * @param TelegramMethods $method |
||
41 | * @return array |
||
42 | */ |
||
43 | public function checkSpecialConditions(TelegramMethods $method): array |
||
64 | |||
65 | /** |
||
66 | * Builds up a multipart form-like array for Guzzle |
||
67 | * |
||
68 | * @param array $data The original object in array form |
||
69 | * @param string $fileKeyName A file handler will be sent instead of a string, state here which field it is |
||
70 | * @param resource $stream The actual file handler |
||
71 | * @return array Returns the actual formdata to be sent |
||
72 | */ |
||
73 | 2 | public function buildMultipartFormData(array $data, string $fileKeyName, $stream): array |
|
97 | } |
||
98 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: