@@ -21,7 +21,7 @@ |
||
21 | 21 | public int $score; |
22 | 22 | |
23 | 23 | |
24 | - public function __construct(stdClass|null $object = null) { |
|
24 | + public function __construct(stdClass | null $object = null) { |
|
25 | 25 | if ($object != null) { |
26 | 26 | parent::__construct($object, self::subs); |
27 | 27 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the |
53 | 53 | * thumbnail was uploaded using multipart/form-data under <file_attach_name>. |
54 | 54 | */ |
55 | - public CURLFile|string $thumb; |
|
55 | + public CURLFile | string $thumb; |
|
56 | 56 | |
57 | 57 | /** `video` and `animation` only. width */ |
58 | 58 | public int $width; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | public bool $disable_content_type_detection; |
80 | 80 | |
81 | 81 | |
82 | - public function __construct(stdClass|null $object = null) { |
|
82 | + public function __construct(stdClass | null $object = null) { |
|
83 | 83 | if ($object != null) { |
84 | 84 | parent::__construct($object, self::subs); |
85 | 85 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | public string $custom_emoji_id; |
50 | 50 | |
51 | 51 | |
52 | - public function __construct(stdClass|null $object = null) { |
|
52 | + public function __construct(stdClass | null $object = null) { |
|
53 | 53 | if ($object != null) { |
54 | 54 | parent::__construct($object, self::subs); |
55 | 55 | } |
@@ -9,4 +9,4 @@ |
||
9 | 9 | * |
10 | 10 | * @todo make it usefully (it's not called at all) |
11 | 11 | */ |
12 | -class telegramException extends Exception{} |
|
13 | 12 | \ No newline at end of file |
13 | +class telegramException extends Exception {} |
|
14 | 14 | \ No newline at end of file |
@@ -41,13 +41,13 @@ discard block |
||
41 | 41 | } |
42 | 42 | |
43 | 43 | if (!tools::isTelegram($ip ?? '')) { |
44 | - logger::write('not authorized access denied. IP : '. $ip ?? 'unknown',loggerTypes::WARNING); |
|
44 | + logger::write('not authorized access denied. IP : '.$ip ?? 'unknown', loggerTypes::WARNING); |
|
45 | 45 | BPT::exit(); |
46 | 46 | } |
47 | 47 | } |
48 | 48 | } |
49 | 49 | |
50 | - protected static function processUpdate(string|stdClass|update $update = null): void { |
|
50 | + protected static function processUpdate(string | stdClass | update $update = null): void { |
|
51 | 51 | if (!is_object($update)) { |
52 | 52 | $update = json_decode($update ?? file_get_contents("php://input")); |
53 | 53 | if (!$update) { |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | - if (!is_a($update,'update')) { |
|
58 | + if (!is_a($update, 'update')) { |
|
59 | 59 | $update = new update($update); |
60 | 60 | } |
61 | 61 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | db::save(); |
67 | 67 | } |
68 | 68 | |
69 | - protected static function setMessageExtra (update &$update): void { |
|
69 | + protected static function setMessageExtra(update & $update): void { |
|
70 | 70 | if ((isset($update->message) && isset($update->message->text)) || (isset($update->edited_message) && isset($update->edited_message->text))) { |
71 | 71 | $type = isset($update->message) ? 'message' : 'edited_message'; |
72 | 72 | $text = &$update->$type->text; |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | BPT::$handler->something_else(BPT::$update); |
140 | 140 | } |
141 | 141 | else { |
142 | - logger::write('Update received but handlers does not set',loggerTypes::WARNING); |
|
142 | + logger::write('Update received but handlers does not set', loggerTypes::WARNING); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | } |
@@ -35,8 +35,7 @@ discard block |
||
35 | 35 | if (isset($_SERVER['HTTP_CF_CONNECTING_IP']) && tools::isCloudFlare($ip)) { |
36 | 36 | $ip = $_SERVER['HTTP_CF_CONNECTING_IP']; |
37 | 37 | } |
38 | - } |
|
39 | - elseif (settings::$arvancloud_verify && isset($_SERVER['HTTP_AR_REAL_IP']) && tools::isArvanCloud($ip)) { |
|
38 | + } elseif (settings::$arvancloud_verify && isset($_SERVER['HTTP_AR_REAL_IP']) && tools::isArvanCloud($ip)) { |
|
40 | 39 | $ip = $_SERVER['HTTP_AR_REAL_IP']; |
41 | 40 | } |
42 | 41 | |
@@ -94,51 +93,41 @@ discard block |
||
94 | 93 | if (self::handlerExist('message')) { |
95 | 94 | BPT::$handler->message(BPT::$update->message); |
96 | 95 | } |
97 | - } |
|
98 | - elseif (isset(BPT::$update->edited_message)) { |
|
96 | + } elseif (isset(BPT::$update->edited_message)) { |
|
99 | 97 | if (self::handlerExist('edited_message')) { |
100 | 98 | BPT::$handler->edited_message(BPT::$update->edited_message); |
101 | 99 | } |
102 | - } |
|
103 | - elseif (isset(BPT::$update->channel_post)) { |
|
100 | + } elseif (isset(BPT::$update->channel_post)) { |
|
104 | 101 | if (self::handlerExist('channel_post')) { |
105 | 102 | BPT::$handler->channel_post(BPT::$update->channel_post); |
106 | 103 | } |
107 | - } |
|
108 | - elseif (isset(BPT::$update->edited_channel_post)) { |
|
104 | + } elseif (isset(BPT::$update->edited_channel_post)) { |
|
109 | 105 | if (self::handlerExist('edited_channel_post')) { |
110 | 106 | BPT::$handler->edited_channel_post(BPT::$update->edited_channel_post); |
111 | 107 | } |
112 | - } |
|
113 | - elseif (isset(BPT::$update->inline_query)) { |
|
108 | + } elseif (isset(BPT::$update->inline_query)) { |
|
114 | 109 | if (self::handlerExist('inline_query')) { |
115 | 110 | BPT::$handler->inline_query(BPT::$update->inline_query); |
116 | 111 | } |
117 | - } |
|
118 | - elseif (isset(BPT::$update->callback_query)) { |
|
112 | + } elseif (isset(BPT::$update->callback_query)) { |
|
119 | 113 | if (self::handlerExist('callback_query')) { |
120 | 114 | BPT::$handler->callback_query(BPT::$update->callback_query); |
121 | 115 | } |
122 | - } |
|
123 | - elseif (isset(BPT::$update->my_chat_member)) { |
|
116 | + } elseif (isset(BPT::$update->my_chat_member)) { |
|
124 | 117 | if (self::handlerExist('my_chat_member')) { |
125 | 118 | BPT::$handler->my_chat_member(BPT::$update->my_chat_member); |
126 | 119 | } |
127 | - } |
|
128 | - elseif (isset(BPT::$update->chat_member)) { |
|
120 | + } elseif (isset(BPT::$update->chat_member)) { |
|
129 | 121 | if (self::handlerExist('chat_member')) { |
130 | 122 | BPT::$handler->chat_member(BPT::$update->chat_member); |
131 | 123 | } |
132 | - } |
|
133 | - elseif (isset(BPT::$update->chat_join_request)) { |
|
124 | + } elseif (isset(BPT::$update->chat_join_request)) { |
|
134 | 125 | if (self::handlerExist('chat_join_request')) { |
135 | 126 | BPT::$handler->chat_join_request(BPT::$update->chat_join_request); |
136 | 127 | } |
137 | - } |
|
138 | - elseif (self::handlerExist('something_else')) { |
|
128 | + } elseif (self::handlerExist('something_else')) { |
|
139 | 129 | BPT::$handler->something_else(BPT::$update); |
140 | - } |
|
141 | - else { |
|
130 | + } else { |
|
142 | 131 | logger::write('Update received but handlers does not set',loggerTypes::WARNING); |
143 | 132 | } |
144 | 133 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | /** |
18 | 18 | * @internal Only for BPT self usage , Don't use it in your source! |
19 | 19 | */ |
20 | - public static function init (): void { |
|
20 | + public static function init(): void { |
|
21 | 21 | if (!empty(settings::$db)) { |
22 | 22 | if (!isset(settings::$db['type'])) { |
23 | 23 | settings::$db['type'] = dbTypes::JSON; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | public string $big_file_unique_id; |
38 | 38 | |
39 | 39 | |
40 | - public function __construct(stdClass|null $object = null) { |
|
40 | + public function __construct(stdClass | null $object = null) { |
|
41 | 41 | if ($object != null) { |
42 | 42 | parent::__construct($object, self::subs); |
43 | 43 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @return bool|string string will be returned when destination doesn't set |
61 | 61 | */ |
62 | - public function download(string|null $destination = null,bool $big = true): bool|string { |
|
63 | - return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.mp4',$big ? $this->big_file_id : $this->small_file_id); |
|
62 | + public function download(string | null $destination = null, bool $big = true): bool | string { |
|
63 | + return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.mp4', $big ? $this->big_file_id : $this->small_file_id); |
|
64 | 64 | } |
65 | 65 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | /** Keep all of properties which has sub properties */ |
12 | 12 | private const subs = []; |
13 | 13 | |
14 | - public function __construct(stdClass|null $object = null) { |
|
14 | + public function __construct(stdClass | null $object = null) { |
|
15 | 15 | if ($object != null) { |
16 | 16 | parent::__construct($object, self::subs); |
17 | 17 | } |
@@ -67,7 +67,7 @@ |
||
67 | 67 | public bool $can_manage_topics; |
68 | 68 | |
69 | 69 | |
70 | - public function __construct(stdClass|null $object = null) { |
|
70 | + public function __construct(stdClass | null $object = null) { |
|
71 | 71 | if ($object != null) { |
72 | 72 | parent::__construct($object, self::subs); |
73 | 73 | } |