Passed
Push — main ( e0778d...2e4cb3 )
by Miaad
10:42
created
src/tools/tools.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 /**
32 32
  * tools class , gather what ever you need
33 33
  */
34
-class tools{
34
+class tools {
35 35
     /**
36 36
      * Check the given username format
37 37
      *
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      *
44 44
      * @return bool
45 45
      */
46
-    public static function isUsername (string $username): bool {
46
+    public static function isUsername(string $username): bool {
47 47
         $length = strlen($username);
48 48
         return !str_contains($username, '__') && $length >= 4 && $length <= 33 && preg_match('/^@?([a-zA-Z])(\w{4,31})$/', $username);
49 49
     }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      *
61 61
      * @return bool
62 62
      */
63
-    public static function ipInRange (string $ip, string $range): bool {
63
+    public static function ipInRange(string $ip, string $range): bool {
64 64
         if (!str_contains($range, '/')) {
65 65
             $range .= '/32';
66 66
         }
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      *
81 81
      * @return bool
82 82
      */
83
-    public static function isTelegram (string $ip): bool {
83
+    public static function isTelegram(string $ip): bool {
84 84
         return tools::ipInRange($ip, '149.154.160.0/20') || tools::ipInRange($ip, '91.108.4.0/22');
85 85
     }
86 86
 
@@ -95,10 +95,10 @@  discard block
 block discarded – undo
95 95
      *
96 96
      * @return bool
97 97
      */
98
-    public static function isCloudFlare (string $ip): bool {
98
+    public static function isCloudFlare(string $ip): bool {
99 99
         $cf_ips = ['173.245.48.0/20', '103.21.244.0/22', '103.22.200.0/22', '103.31.4.0/22', '141.101.64.0/18', '108.162.192.0/18', '190.93.240.0/20', '188.114.96.0/20', '197.234.240.0/22', '198.41.128.0/17', '162.158.0.0/15', '104.16.0.0/12', '104.24.0.0/14', '172.64.0.0/13', '131.0.72.0/22'];
100 100
         foreach ($cf_ips as $cf_ip) {
101
-            if (self::ipInRange($ip,$cf_ip)) {
101
+            if (self::ipInRange($ip, $cf_ip)) {
102 102
                 return true;
103 103
             }
104 104
         }
@@ -116,10 +116,10 @@  discard block
 block discarded – undo
116 116
      *
117 117
      * @return bool
118 118
      */
119
-    public static function isArvanCloud (string $ip): bool {
119
+    public static function isArvanCloud(string $ip): bool {
120 120
         $ar_ips = ['185.143.232.0/22', '92.114.16.80/28', '2.146.0.0/28', '46.224.2.32/29', '89.187.178.96/29', '195.181.173.128/29', '89.187.169.88/29', '188.229.116.16/29', '83.123.255.56/31', '164.138.128.28/31', '94.182.182.28/30', '185.17.115.176/30', '5.213.255.36/31', '138.128.139.144/29', '5.200.14.8/29', '188.122.68.224/29', '188.122.83.176/29', '213.179.217.16/29', '185.179.201.192/29', '43.239.139.192/29', '213.179.197.16/29', '213.179.201.192/29', '109.200.214.248/29', '138.128.141.16/29', '188.122.78.136/29', '213.179.211.32/29', '103.194.164.24/29', '185.50.105.136/29', '213.179.213.16/29', '162.244.52.120/29', '188.122.80.240/29', '109.200.195.64/29', '109.200.199.224/29', '185.228.238.0/28', '94.182.153.24/29', '94.101.182.0/27', '37.152.184.208/28', '78.39.156.192/28', '158.255.77.238/31', '81.12.28.16/29', '176.65.192.202/31', '2.144.3.128/28', '89.45.48.64/28', '37.32.16.0/27', '37.32.17.0/27', '37.32.18.0/27'];
121 121
         foreach ($ar_ips as $ar_ip) {
122
-            if (self::ipInRange($ip,$ar_ip)) {
122
+            if (self::ipInRange($ip, $ar_ip)) {
123 123
                 return true;
124 124
             }
125 125
         }
@@ -139,11 +139,11 @@  discard block
 block discarded – undo
139 139
      *
140 140
      * @return bool|user return array when verify is active and token is true array of telegram getMe result
141 141
      */
142
-    public static function isToken (string $token, bool $verify = false): bool|user {
142
+    public static function isToken(string $token, bool $verify = false): bool | user {
143 143
         if (!preg_match('/^(\d{8,10}):[\w\-]{35}$/', $token)) {
144 144
             return false;
145 145
         }
146
-        if (!$verify){
146
+        if (!$verify) {
147 147
             return true;
148 148
         }
149 149
         $res = telegram::me($token);
@@ -173,14 +173,14 @@  discard block
 block discarded – undo
173 173
      *
174 174
      * @return bool
175 175
      */
176
-    public static function isJoined (array|string|int $ids , int|null $user_id = null): bool {
176
+    public static function isJoined(array | string | int $ids, int | null $user_id = null): bool {
177 177
         if (!is_array($ids)) {
178 178
             $ids = [$ids];
179 179
         }
180 180
         $user_id = $user_id ?? request::catchFields('user_id');
181 181
 
182 182
         foreach ($ids as $id) {
183
-            $check = telegram::getChatMember($id,$user_id);
183
+            $check = telegram::getChatMember($id, $user_id);
184 184
             if (telegram::$status) {
185 185
                 $check = $check->status;
186 186
                 if ($check === chatMemberStatus::LEFT || $check === chatMemberStatus::KICKED) {
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
      *
208 208
      * @return array keys will be id and values will be bool(null for not founded ids)
209 209
      */
210
-    public static function joinChecker (array|string|int $ids , int|null $user_id = null): array {
210
+    public static function joinChecker(array | string | int $ids, int | null $user_id = null): array {
211 211
         if (!is_array($ids)) {
212 212
             $ids = [$ids];
213 213
         }
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 
216 216
         $result = [];
217 217
         foreach ($ids as $id) {
218
-            $check = telegram::getChatMember($id,$user_id);
218
+            $check = telegram::getChatMember($id, $user_id);
219 219
             if (telegram::$status) {
220 220
                 $check = $check->status;
221 221
                 $result[$id] = $check !== chatMemberStatus::LEFT && $check !== chatMemberStatus::KICKED;
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
      * @return bool
236 236
      */
237 237
     public static function isShorted(string $text): bool{
238
-        return preg_match('/^[a-zA-Z0-9]+$/',$text);
238
+        return preg_match('/^[a-zA-Z0-9]+$/', $text);
239 239
     }
240 240
 
241 241
     /**
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
      *
254 254
      * @return string|int|false string for formatted data , int for normal data , false when size can not be found(file not found or ...)
255 255
      */
256
-    public static function size (string $path, bool $format = true, bool $space_between = true): string|int|false {
256
+    public static function size(string $path, bool $format = true, bool $space_between = true): string | int | false {
257 257
         if (filter_var($path, FILTER_VALIDATE_URL)) {
258 258
             $ch = curl_init($path);
259 259
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
             $size = file_exists($path) ? filesize($path) : false;
269 269
         }
270 270
         if (isset($size) && is_numeric($size)) {
271
-            return $format ? tools::byteFormat($size, space_between: $space_between) : $size;
271
+            return $format ? tools::byteFormat($size, space_between : $space_between) : $size;
272 272
         }
273 273
         return false;
274 274
     }
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
      * @return bool
287 287
      * @throws bptException
288 288
      */
289
-    public static function delete (string $path, bool $sub = true): bool {
289
+    public static function delete(string $path, bool $sub = true): bool {
290 290
         $path = realpath($path);
291 291
         if (!is_dir($path)) {
292 292
             return unlink($path);
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
             return rmdir($path);
296 296
         }
297 297
         if (!$sub) {
298
-            logger::write("tools::delete function used\ndelete function cannot delete folder because its have subFiles and sub parameter haven't true value",loggerTypes::ERROR);
298
+            logger::write("tools::delete function used\ndelete function cannot delete folder because its have subFiles and sub parameter haven't true value", loggerTypes::ERROR);
299 299
             throw new bptException('DELETE_FOLDER_HAS_SUB');
300 300
         }
301 301
         $it = new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS);
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
      * @return bool
318 318
      * @throws bptException when zip extension not found
319 319
      */
320
-    public static function zip (string $path, string $destination): bool {
320
+    public static function zip(string $path, string $destination): bool {
321 321
         if (!extension_loaded('zip')) {
322 322
             logger::write("tools::zip function used\nzip extension is not found , It may not be installed or enabled", loggerTypes::ERROR);
323 323
             throw new bptException('ZIP_EXTENSION_MISSING');
@@ -351,14 +351,14 @@  discard block
 block discarded – undo
351 351
      *
352 352
      * @return bool true on success and false in failure
353 353
      */
354
-    public static function downloadFile (string $url, string $path, int $chunk_size = 512): bool {
354
+    public static function downloadFile(string $url, string $path, int $chunk_size = 512): bool {
355 355
         $file = fopen($url, 'rb');
356 356
         if (!$file) return false;
357 357
         $path = fopen($path, 'wb');
358 358
         if (!$path) return false;
359 359
 
360 360
         $length = $chunk_size * 1024;
361
-        while (!feof($file)){
361
+        while (!feof($file)) {
362 362
             fwrite($path, fread($file, $length), $length);
363 363
         }
364 364
         fclose($path);
@@ -382,10 +382,10 @@  discard block
 block discarded – undo
382 382
      *
383 383
      * @return string
384 384
      */
385
-    public static function byteFormat (int $byte, int $precision = 2, bool $space_between = true): string {
385
+    public static function byteFormat(int $byte, int $precision = 2, bool $space_between = true): string {
386 386
         $rate_counter = 0;
387 387
 
388
-        while ($byte > 1024){
388
+        while ($byte > 1024) {
389 389
             $byte /= 1024;
390 390
             $rate_counter++;
391 391
         }
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
             $byte = round($byte, $precision);
395 395
         }
396 396
 
397
-        return $byte . ($space_between ? ' ' : '') . ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'][$rate_counter];
397
+        return $byte.($space_between ? ' ' : '').['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'][$rate_counter];
398 398
     }
399 399
 
400 400
     /**
@@ -411,10 +411,10 @@  discard block
 block discarded – undo
411 411
      *
412 412
      * @return string|false return false when mode is incorrect
413 413
      */
414
-    public static function modeEscape (string $text, string $mode = parseMode::HTML): string|false {
414
+    public static function modeEscape(string $text, string $mode = parseMode::HTML): string | false {
415 415
         return match ($mode) {
416
-            parseMode::HTML => str_replace(['&', '<', '>',], ['&amp;', '&lt;', '&gt;',], $text),
417
-            parseMode::MARKDOWN => str_replace(['\\', '_', '*', '`', '['], ['\\\\', '\_', '\*', '\`', '\[',], $text),
416
+            parseMode::HTML => str_replace(['&', '<', '>', ], ['&amp;', '&lt;', '&gt;', ], $text),
417
+            parseMode::MARKDOWN => str_replace(['\\', '_', '*', '`', '['], ['\\\\', '\_', '\*', '\`', '\[', ], $text),
418 418
             parseMode::MARKDOWNV2 => str_replace(
419 419
                 ['\\', '_', '*', '[', ']', '(', ')', '~', '`', '>', '#', '+', '-', '=', '|', '{', '}', '.', '!'],
420 420
                 ['\\\\', '\_', '\*', '\[', '\]', '\(', '\)', '\~', '\`', '\>', '\#', '\+', '\-', '\=', '\|', '\{', '\}', '\.', '\!'],
@@ -453,9 +453,9 @@  discard block
 block discarded – undo
453 453
      * @return array{status: string,year: string,month: string,day: string,hour: string,minute: string,second: string}
454 454
      * @throws Exception
455 455
      */
456
-    public static function timeDiff (int|string $target_time, int|string|null $base_time = null): array {
456
+    public static function timeDiff(int | string $target_time, int | string | null $base_time = null): array {
457 457
         $base_time = new DateTime($base_time ?? '@'.time());
458
-        $target_time = new DateTime(is_numeric($target_time) ? '@' . $target_time : $target_time . ' +00:00');
458
+        $target_time = new DateTime(is_numeric($target_time) ? '@'.$target_time : $target_time.' +00:00');
459 459
 
460 460
         $diff = $base_time->diff($target_time);
461 461
         $string = ['year' => 'y', 'month' => 'm', 'day' => 'd', 'hour' => 'h', 'minute' => 'i', 'second' => 's'];
@@ -481,12 +481,12 @@  discard block
 block discarded – undo
481 481
      *
482 482
      * @return string[]|string
483 483
      */
484
-    public static function realEscapeString(string|array $input): string|array {
485
-        if(is_array($input)) {
484
+    public static function realEscapeString(string | array $input): string | array {
485
+        if (is_array($input)) {
486 486
             return array_map(__METHOD__, $input);
487 487
         }
488 488
 
489
-        if(!empty($input) && is_string($input)) {
489
+        if (!empty($input) && is_string($input)) {
490 490
             return str_replace(['\\', "\0", "\n", "\r", "'", '"', "\x1a"], ['\\\\', '\\0', '\\n', '\\r', "\\'", '\\"', '\\Z'], $input);
491 491
         }
492 492
 
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
      *
505 505
      * @return string[]|string
506 506
      */
507
-    public static function strReplaceFirst(string|array $search, string|array $replace, string|array $subject): string|array {
507
+    public static function strReplaceFirst(string | array $search, string | array $replace, string | array $subject): string | array {
508 508
         $pos = strpos($subject, $search);
509 509
         if ($pos !== false) {
510 510
             return substr_replace($subject, $replace, $pos, strlen($search));
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
      *
524 524
      * @return string[]|string
525 525
      */
526
-    public static function strReplaceLast(string|array $search, string|array $replace, string|array $subject): string|array {
526
+    public static function strReplaceLast(string | array $search, string | array $replace, string | array $subject): string | array {
527 527
         $pos = strrpos($subject, $search);
528 528
         if ($pos !== false) {
529 529
             return substr_replace($subject, $replace, $pos, strlen($search));
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
      *
541 541
      * @return string see possible values in fileType class
542 542
      */
543
-    public static function fileType (string $file_id): string {
543
+    public static function fileType(string $file_id): string {
544 544
         $data = base64_decode(str_pad(strtr($file_id, '-_', '+/'), strlen($file_id) % 4, '='));
545 545
         $new = '';
546 546
         $last = '';
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
                 $last = $char;
555 555
             }
556 556
         }
557
-        $data = unpack('VtypeId/Vdc_id', $new . $last);
557
+        $data = unpack('VtypeId/Vdc_id', $new.$last);
558 558
         $data['typeId'] = $data['typeId'] & ~33554432 & ~16777216;
559 559
         return [
560 560
             fileTypes::THUMBNAIL,
@@ -592,10 +592,10 @@  discard block
 block discarded – undo
592 592
      *
593 593
      * @return string
594 594
      */
595
-    public static function randomString (int $length = 16, string $characters = 'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ'): string {
595
+    public static function randomString(int $length = 16, string $characters = 'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ'): string {
596 596
         $rand_string = '';
597 597
         $char_len = strlen($characters) - 1;
598
-        for ($i = 0; $i < $length; $i ++) {
598
+        for ($i = 0; $i < $length; $i++) {
599 599
             $rand_string .= $characters[rand(0, $char_len)];
600 600
         }
601 601
         return $rand_string;
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
      * @return inlineKeyboardMarkup|replyKeyboardMarkup replyKeyboardMarkup for keyboard and inlineKeyboardMarkup for inline
625 625
      * @throws bptException
626 626
      */
627
-    public static function easyKey(array $keyboard = [], array $inline = []): inlineKeyboardMarkup|replyKeyboardMarkup {
627
+    public static function easyKey(array $keyboard = [], array $inline = []): inlineKeyboardMarkup | replyKeyboardMarkup {
628 628
         if (!empty($keyboard)) {
629 629
             $keyboard_object = new replyKeyboardMarkup();
630 630
             $keyboard_object->setResize_keyboard($keyboard['resize'] ?? true);
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
             $keyboard_object->setInline_keyboard($rows);
689 689
             return $keyboard_object;
690 690
         }
691
-        logger::write("tools::eKey function used\nkeyboard or inline parameter must be set",loggerTypes::ERROR);
691
+        logger::write("tools::eKey function used\nkeyboard or inline parameter must be set", loggerTypes::ERROR);
692 692
         throw new bptException('ARGUMENT_NOT_FOUND_KEYBOARD_INLINE');
693 693
     }
694 694
 
@@ -704,10 +704,10 @@  discard block
 block discarded – undo
704 704
      *
705 705
      * @return string
706 706
      */
707
-    public static function inviteLink (int $user_id = null, string $bot_username = null): string {
707
+    public static function inviteLink(int $user_id = null, string $bot_username = null): string {
708 708
         if (empty($user_id)) $user_id = telegram::catchFields(fields::USER_ID);
709 709
         if (empty($bot_username)) $bot_username = telegram::getMe()->username;
710
-        return 'https://t.me/' . str_replace('@', '', $bot_username) . '?start=ref_' . tools::shortEncode($user_id);
710
+        return 'https://t.me/'.str_replace('@', '', $bot_username).'?start=ref_'.tools::shortEncode($user_id);
711 711
     }
712 712
 
713 713
     /**
@@ -733,9 +733,9 @@  discard block
 block discarded – undo
733 733
      * @return string|bool|array{hash:string, key:string, iv:string}
734 734
      * @throws bptException
735 735
      */
736
-    public static function codec (string $action, string $text, string $key = null, string $iv = null): bool|array|string {
736
+    public static function codec(string $action, string $text, string $key = null, string $iv = null): bool | array | string {
737 737
         if (!extension_loaded('openssl')) {
738
-            logger::write("tools::codec function used\nopenssl extension is not found , It may not be installed or enabled",loggerTypes::ERROR);
738
+            logger::write("tools::codec function used\nopenssl extension is not found , It may not be installed or enabled", loggerTypes::ERROR);
739 739
             throw new bptException('OPENSSL_EXTENSION_MISSING');
740 740
         }
741 741
         if ($action === codecAction::ENCRYPT) {
@@ -746,16 +746,16 @@  discard block
 block discarded – undo
746 746
         }
747 747
         if ($action === codecAction::DECRYPT) {
748 748
             if (empty($key)) {
749
-                logger::write("tools::codec function used\nkey parameter is not set",loggerTypes::ERROR);
749
+                logger::write("tools::codec function used\nkey parameter is not set", loggerTypes::ERROR);
750 750
                 throw new bptException('ARGUMENT_NOT_FOUND_KEY');
751 751
             }
752 752
             if (empty($iv)) {
753
-                logger::write("tools::codec function used\niv parameter is not set",loggerTypes::ERROR);
753
+                logger::write("tools::codec function used\niv parameter is not set", loggerTypes::ERROR);
754 754
                 throw new bptException('ARGUMENT_NOT_FOUND_IV');
755 755
             }
756 756
             return openssl_decrypt(base64_decode($text), 'AES-256-CBC', $key, 1, $iv);
757 757
         }
758
-        logger::write("tools::codec function used\naction is not right, its must be `encode` or `decode`",loggerTypes::WARNING);
758
+        logger::write("tools::codec function used\naction is not right, its must be `encode` or `decode`", loggerTypes::WARNING);
759 759
         return false;
760 760
     }
761 761
 
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
     public static function shortEncode(int $num): string {
772 772
         $codes = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
773 773
         $array = [];
774
-        while ($num > 0){
774
+        while ($num > 0) {
775 775
             $array[] = $num % 62;
776 776
             $num = floor($num / 62);
777 777
         }
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
         foreach ($array as &$value) {
780 780
             $value = $codes[$value];
781 781
         }
782
-        return strrev(implode('',$array));
782
+        return strrev(implode('', $array));
783 783
     }
784 784
 
785 785
     /**
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
         $num = 0;
797 797
         $text = str_split(strrev($text));
798 798
         foreach ($text as $key=>$value) {
799
-            $num += strpos($codes,$value) * pow(62,$key);
799
+            $num += strpos($codes, $value) * pow(62, $key);
800 800
         }
801 801
         return $num;
802 802
     }
Please login to merge, or discard this patch.
src/types/types.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
      *
25 25
      * @return false|string
26 26
      */
27
-    public function toJson (int $flags = 0): false|string {
27
+    public function toJson(int $flags = 0): false | string {
28 28
         $array = json_decode(json_encode($this), true);
29 29
 
30
-        $cleanArray = function ($array) use (&$cleanArray) {
30
+        $cleanArray = function($array) use (&$cleanArray) {
31 31
             return array_filter(array_map(fn($value) => is_array($value) ? $cleanArray($value) : $value, $array));
32 32
         };
33 33
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             }
57 57
             else {
58 58
                 $this->{$key} = $value;
59
-                if (ucfirst($key) === basename(get_class($this)) . '_id') {
59
+                if (ucfirst($key) === basename(get_class($this)).'_id') {
60 60
                     $this->{'id'} = $value;
61 61
                 }
62 62
             }
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     public function __call(string $name, array $arguments) {
67 67
         $name = strtolower($name);
68 68
         if (str_starts_with($name, 'set')) {
69
-            $name = substr($name,3);
69
+            $name = substr($name, 3);
70 70
             if (isset($arguments[0])) {
71 71
                 $this->{$name} = $arguments[0];
72 72
             }
Please login to merge, or discard this patch.
src/types/update.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -54,114 +54,114 @@
 block discarded – undo
54 54
     public int $update_id;
55 55
 
56 56
     /** Optional. New incoming message of any kind - text, photo, sticker, etc. */
57
-    public null|message $message = null;
57
+    public null | message $message = null;
58 58
 
59 59
     /**
60 60
      * Optional. New version of a message that is known to the bot and was edited. This update may at times be
61 61
      * triggered by changes to message fields that are either unavailable or not actively used by your bot.
62 62
      */
63
-    public null|message $edited_message = null;
63
+    public null | message $edited_message = null;
64 64
 
65 65
     /** Optional. New incoming channel post of any kind - text, photo, sticker, etc. */
66
-    public null|message $channel_post = null;
66
+    public null | message $channel_post = null;
67 67
 
68 68
     /**
69 69
      * Optional. New version of a channel post that is known to the bot and was edited. This update may at times be
70 70
      * triggered by changes to message fields that are either unavailable or not actively used by your bot.
71 71
      */
72
-    public null|message $edited_channel_post = null;
72
+    public null | message $edited_channel_post = null;
73 73
 
74 74
     /**
75 75
      * Optional. The bot was connected to or disconnected from a business account, or a user edited an existing
76 76
      * connection with the bot
77 77
      */
78
-    public null|businessConnection $business_connection = null;
78
+    public null | businessConnection $business_connection = null;
79 79
 
80 80
     /** Optional. New message from a connected business account */
81
-    public null|message $business_message = null;
81
+    public null | message $business_message = null;
82 82
 
83 83
     /** Optional. New version of a message from a connected business account */
84
-    public null|message $edited_business_message = null;
84
+    public null | message $edited_business_message = null;
85 85
 
86 86
     /** Optional. Messages were deleted from a connected business account */
87
-    public null|businessMessagesDeleted $deleted_business_messages = null;
87
+    public null | businessMessagesDeleted $deleted_business_messages = null;
88 88
 
89 89
     /**
90 90
      * Optional. A reaction to a message was changed by a user. The bot must be an administrator in the chat and must
91 91
      * explicitly specify "message_reaction" in the list of allowed_updates to receive these updates. The update
92 92
      * isn't received for reactions set by bots.
93 93
      */
94
-    public null|messageReactionUpdated $message_reaction = null;
94
+    public null | messageReactionUpdated $message_reaction = null;
95 95
 
96 96
     /**
97 97
      * Optional. Reactions to a message with anonymous reactions were changed. The bot must be an administrator in
98 98
      * the chat and must explicitly specify "message_reaction_count" in the list of allowed_updates to receive these
99 99
      * updates. The updates are grouped and can be sent with delay up to a few minutes.
100 100
      */
101
-    public null|messageReactionCountUpdated $message_reaction_count = null;
101
+    public null | messageReactionCountUpdated $message_reaction_count = null;
102 102
 
103 103
     /** Optional. New incoming inline query */
104
-    public null|inlineQuery $inline_query = null;
104
+    public null | inlineQuery $inline_query = null;
105 105
 
106 106
     /**
107 107
      * Optional. The result of an inline query that was chosen by a user and sent to their chat partner. Please see
108 108
      * our documentation on the feedback collecting for details on how to enable these updates for your bot.
109 109
      */
110
-    public null|chosenInlineResult $chosen_inline_result = null;
110
+    public null | chosenInlineResult $chosen_inline_result = null;
111 111
 
112 112
     /** Optional. New incoming callback query */
113
-    public null|callbackQuery $callback_query = null;
113
+    public null | callbackQuery $callback_query = null;
114 114
 
115 115
     /** Optional. New incoming shipping query. Only for invoices with flexible price */
116
-    public null|shippingQuery $shipping_query = null;
116
+    public null | shippingQuery $shipping_query = null;
117 117
 
118 118
     /** Optional. New incoming pre-checkout query. Contains full information about checkout */
119
-    public null|preCheckoutQuery $pre_checkout_query = null;
119
+    public null | preCheckoutQuery $pre_checkout_query = null;
120 120
 
121 121
     /**
122 122
      * Optional. New poll state. Bots receive only updates about manually stopped polls and polls, which are sent by
123 123
      * the bot
124 124
      */
125
-    public null|poll $poll = null;
125
+    public null | poll $poll = null;
126 126
 
127 127
     /**
128 128
      * Optional. A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were
129 129
      * sent by the bot itself.
130 130
      */
131
-    public null|pollAnswer $poll_answer = null;
131
+    public null | pollAnswer $poll_answer = null;
132 132
 
133 133
     /**
134 134
      * Optional. The bot's chat member status was updated in a chat. For private chats, this update is received only
135 135
      * when the bot is blocked or unblocked by the user.
136 136
      */
137
-    public null|chatMemberUpdated $my_chat_member = null;
137
+    public null | chatMemberUpdated $my_chat_member = null;
138 138
 
139 139
     /**
140 140
      * Optional. A chat member's status was updated in a chat. The bot must be an administrator in the chat and must
141 141
      * explicitly specify "chat_member" in the list of allowed_updates to receive these updates.
142 142
      */
143
-    public null|chatMemberUpdated $chat_member = null;
143
+    public null | chatMemberUpdated $chat_member = null;
144 144
 
145 145
     /**
146 146
      * Optional. A request to join the chat has been sent. The bot must have the can_invite_users administrator right
147 147
      * in the chat to receive these updates.
148 148
      */
149
-    public null|chatJoinRequest $chat_join_request = null;
149
+    public null | chatJoinRequest $chat_join_request = null;
150 150
 
151 151
     /**
152 152
      * Optional. A chat boost was added or changed. The bot must be an administrator in the chat to receive these
153 153
      * updates.
154 154
      */
155
-    public null|chatBoostUpdated $chat_boost = null;
155
+    public null | chatBoostUpdated $chat_boost = null;
156 156
 
157 157
     /**
158 158
      * Optional. A boost was removed from a chat. The bot must be an administrator in the chat to receive these
159 159
      * updates.
160 160
      */
161
-    public null|chatBoostRemoved $removed_chat_boost = null;
161
+    public null | chatBoostRemoved $removed_chat_boost = null;
162 162
 
163 163
 
164
-    public function __construct(stdClass|null $object = null) {
164
+    public function __construct(stdClass | null $object = null) {
165 165
         if ($object != null) {
166 166
             parent::__construct($object, self::subs);
167 167
         }
Please login to merge, or discard this patch.
src/types/message.php 1 patch
Spacing   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -84,13 +84,13 @@  discard block
 block discarded – undo
84 84
     public int $message_id;
85 85
 
86 86
     /** Optional. Unique identifier of a message thread to which the message belongs; for supergroups only */
87
-    public null|int $message_thread_id = null;
87
+    public null | int $message_thread_id = null;
88 88
 
89 89
     /**
90 90
      * Optional. Sender of the message; empty for messages sent to channels. For backward compatibility, the field
91 91
      * contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.
92 92
      */
93
-    public null|user $from = null;
93
+    public null | user $from = null;
94 94
 
95 95
     /**
96 96
      * Optional. Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts,
@@ -98,16 +98,16 @@  discard block
 block discarded – undo
98 98
      * automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake
99 99
      * sender user in non-channel chats, if the message was sent on behalf of a chat.
100 100
      */
101
-    public null|chat $sender_chat = null;
101
+    public null | chat $sender_chat = null;
102 102
 
103 103
     /** Optional. If the sender of the message boosted the chat, the number of boosts added by the user */
104
-    public null|int $sender_boost_count = null;
104
+    public null | int $sender_boost_count = null;
105 105
 
106 106
     /**
107 107
      * Optional. The bot that actually sent the message on behalf of the business account. Available only for
108 108
      * outgoing messages sent on behalf of the connected business account.
109 109
      */
110
-    public null|user $sender_business_bot = null;
110
+    public null | user $sender_business_bot = null;
111 111
 
112 112
     /** Date the message was sent in Unix time. It is always a positive number, representing a valid date. */
113 113
     public int $date;
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      * message belongs to a chat of the corresponding business account that is independent from any potential bot
118 118
      * chat which might share the same identifier.
119 119
      */
120
-    public null|string $business_connection_id = null;
120
+    public null | string $business_connection_id = null;
121 121
 
122 122
     /** Chat the message belongs to */
123 123
     public chat $chat;
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
      *
128 128
      * @deprecated used forward_origin instead
129 129
      */
130
-    public null|user $forward_from = null;
130
+    public null | user $forward_from = null;
131 131
 
132 132
     /**
133 133
      * Optional. For messages forwarded from channels or from anonymous administrators, information about the
@@ -135,14 +135,14 @@  discard block
 block discarded – undo
135 135
      *
136 136
      * @deprecated used forward_origin instead
137 137
      */
138
-    public null|chat $forward_from_chat = null;
138
+    public null | chat $forward_from_chat = null;
139 139
 
140 140
     /**
141 141
      * Optional. For messages forwarded from channels, identifier of the original message in the channel
142 142
      *
143 143
      * @deprecated used forward_origin instead
144 144
      */
145
-    public null|int $forward_from_message_id = null;
145
+    public null | int $forward_from_message_id = null;
146 146
 
147 147
     /**
148 148
      * Optional. For forwarded messages that were originally sent in channels or by an anonymous chat administrator,
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
      *
151 151
      * @deprecated used forward_origin instead
152 152
      */
153
-    public null|string $forward_signature = null;
153
+    public null | string $forward_signature = null;
154 154
 
155 155
     /**
156 156
      * Optional. Sender's name for messages forwarded from users who disallow adding a link to their account in
@@ -158,206 +158,206 @@  discard block
 block discarded – undo
158 158
      *
159 159
      * @deprecated used forward_origin instead
160 160
      */
161
-    public null|string $forward_sender_name = null;
161
+    public null | string $forward_sender_name = null;
162 162
 
163 163
     /**
164 164
      * Optional. For forwarded messages, date the original message was sent in Unix time
165 165
      * @deprecated used forward_origin instead
166 166
      */
167
-    public null|int $forward_date = null;
167
+    public null | int $forward_date = null;
168 168
 
169 169
     /** Optional. Information about the original message for forwarded messages */
170
-    public null|messageOrigin $forward_origin = null;
170
+    public null | messageOrigin $forward_origin = null;
171 171
 
172 172
     /** Optional. True, if the message is sent to a forum topic */
173
-    public null|bool $is_topic_message = null;
173
+    public null | bool $is_topic_message = null;
174 174
 
175 175
     /**
176 176
      * Optional. True, if the message is a channel post that was automatically forwarded to the connected discussion
177 177
      * group
178 178
      */
179
-    public null|bool $is_automatic_forward = null;
179
+    public null | bool $is_automatic_forward = null;
180 180
 
181 181
     /**
182 182
      * Optional. For replies in the same chat and message thread, the original message. Note that the Message object
183 183
      * in this field will not contain further reply_to_message fields even if it itself is a reply.
184 184
      */
185
-    public null|message $reply_to_message = null;
185
+    public null | message $reply_to_message = null;
186 186
 
187 187
     /**
188 188
      * Optional. Information about the message that is being replied to, which may come from another chat or forum
189 189
      * topic
190 190
      */
191
-    public null|externalReplyInfo $external_reply = null;
191
+    public null | externalReplyInfo $external_reply = null;
192 192
 
193 193
     /** Optional. For replies that quote part of the original message, the quoted part of the message */
194
-    public null|textQuote $quote = null;
194
+    public null | textQuote $quote = null;
195 195
 
196 196
     /** Optional. For replies to a story, the original story */
197
-    public null|story $reply_to_story = null;
197
+    public null | story $reply_to_story = null;
198 198
 
199 199
     /** Optional. Bot through which the message was sent */
200
-    public null|user $via_bot = null;
200
+    public null | user $via_bot = null;
201 201
 
202 202
     /** Optional. Date the message was last edited in Unix time */
203
-    public null|int $edit_date = null;
203
+    public null | int $edit_date = null;
204 204
 
205 205
     /** Optional. True, if the message can't be forwarded */
206
-    public null|bool $has_protected_content = null;
206
+    public null | bool $has_protected_content = null;
207 207
 
208 208
     /**
209 209
      * Optional. True, if the message was sent by an implicit action, for example, as an away or a greeting business
210 210
      * message, or as a scheduled message
211 211
      */
212
-    public null|bool $is_from_offline = null;
212
+    public null | bool $is_from_offline = null;
213 213
 
214 214
     /** Optional. The unique identifier of a media message group this message belongs to */
215
-    public null|string $media_group_id = null;
215
+    public null | string $media_group_id = null;
216 216
 
217 217
     /**
218 218
      * Optional. Signature of the post author for messages in channels, or the custom title of an anonymous group
219 219
      * administrator
220 220
      */
221
-    public null|string $author_signature = null;
221
+    public null | string $author_signature = null;
222 222
 
223 223
     /** Optional. For text messages, the actual UTF-8 text of the message */
224
-    public null|string $text = null;
224
+    public null | string $text = null;
225 225
 
226 226
     /** Optional. If user message was a command , this parameter will be the command */
227
-    public string|null $command = null;
227
+    public string | null $command = null;
228 228
 
229 229
     /** Optional. If user message was a command , this parameter will be the command username(if exist) */
230
-    public string|null $command_username = null;
230
+    public string | null $command_username = null;
231 231
 
232 232
     /** Optional. If user message was a command , this parameter will be the command payload(if exist) */
233
-    public string|null $command_payload = null;
233
+    public string | null $command_payload = null;
234 234
 
235 235
     /**
236 236
      * Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text
237 237
      * @var messageEntity[]
238 238
      */
239
-    public null|array $entities = null;
239
+    public null | array $entities = null;
240 240
 
241 241
     /**
242 242
      * Optional. Options used for link preview generation for the message, if it is a text message and link preview
243 243
      * options were changed
244 244
      */
245
-    public null|linkPreviewOptions $link_preview_options = null;
245
+    public null | linkPreviewOptions $link_preview_options = null;
246 246
 
247 247
     /** Optional. Unique identifier of the message effect added to the message */
248
-    public null|string $effect_id = null;
248
+    public null | string $effect_id = null;
249 249
 
250 250
     /**
251 251
      * Optional. Message is an animation, information about the animation. For backward compatibility, when this
252 252
      * field is set, the document field will also be set
253 253
      */
254
-    public null|animation $animation = null;
254
+    public null | animation $animation = null;
255 255
 
256 256
     /** Optional. Message is an audio file, information about the file */
257
-    public null|audio $audio = null;
257
+    public null | audio $audio = null;
258 258
 
259 259
     /** Optional. Message is a general file, information about the file */
260
-    public null|document $document = null;
260
+    public null | document $document = null;
261 261
 
262 262
     /**
263 263
      * Optional. Message is a photo, available sizes of the photo
264 264
      * @var photoSize[]
265 265
      */
266
-    public null|array $photo = null;
266
+    public null | array $photo = null;
267 267
 
268 268
     /** Optional. Message is a sticker, information about the sticker */
269
-    public null|sticker $sticker = null;
269
+    public null | sticker $sticker = null;
270 270
 
271 271
     /** Optional. Message is a forwarded story */
272
-    public null|story $story = null;
272
+    public null | story $story = null;
273 273
 
274 274
     /** Optional. Message is a video, information about the video */
275
-    public null|video $video = null;
275
+    public null | video $video = null;
276 276
 
277 277
     /** Optional. Message is a video note, information about the video message */
278
-    public null|videoNote $video_note = null;
278
+    public null | videoNote $video_note = null;
279 279
 
280 280
     /** Optional. Message is a voice message, information about the file */
281
-    public null|voice $voice = null;
281
+    public null | voice $voice = null;
282 282
 
283 283
     /** Optional. Caption for the animation, audio, document, photo, video or voice */
284
-    public null|string $caption = null;
284
+    public null | string $caption = null;
285 285
 
286 286
     /**
287 287
      * Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear
288 288
      * in the caption
289 289
      * @var messageEntity[]
290 290
      */
291
-    public null|array $caption_entities = null;
291
+    public null | array $caption_entities = null;
292 292
 
293 293
     /** Optional. True, if the caption must be shown above the message media */
294
-    public null|bool $show_caption_above_media = null;
294
+    public null | bool $show_caption_above_media = null;
295 295
 
296 296
     /** Optional. True, if the message media is covered by a spoiler animation */
297
-    public null|bool $has_media_spoiler = null;
297
+    public null | bool $has_media_spoiler = null;
298 298
 
299 299
     /** Optional. Message is a shared contact, information about the contact */
300
-    public null|contact $contact = null;
300
+    public null | contact $contact = null;
301 301
 
302 302
     /** Optional. Message is a dice with random value */
303
-    public null|dice $dice = null;
303
+    public null | dice $dice = null;
304 304
 
305 305
     /** Optional. Message is a game, information about the game. More about games » */
306
-    public null|game $game = null;
306
+    public null | game $game = null;
307 307
 
308 308
     /** Optional. Message is a native poll, information about the poll */
309
-    public null|poll $poll = null;
309
+    public null | poll $poll = null;
310 310
 
311 311
     /**
312 312
      * Optional. Message is a venue, information about the venue. For backward compatibility, when this field is set,
313 313
      * the location field will also be set
314 314
      */
315
-    public null|venue $venue = null;
315
+    public null | venue $venue = null;
316 316
 
317 317
     /** Optional. Message is a shared location, information about the location */
318
-    public null|location $location = null;
318
+    public null | location $location = null;
319 319
 
320 320
     /**
321 321
      * Optional. New members that were added to the group or supergroup and information about them (the bot itself
322 322
      * may be one of these members)
323 323
      * @var user[]
324 324
      */
325
-    public null|array $new_chat_members = null;
325
+    public null | array $new_chat_members = null;
326 326
 
327 327
     /** Optional. A member was removed from the group, information about them (this member may be the bot itself) */
328
-    public null|user $left_chat_member = null;
328
+    public null | user $left_chat_member = null;
329 329
 
330 330
     /** Optional. A chat title was changed to this value */
331
-    public null|string $new_chat_title = null;
331
+    public null | string $new_chat_title = null;
332 332
 
333 333
     /**
334 334
      * Optional. A chat photo was change to this value
335 335
      * @var photoSize[]
336 336
      */
337
-    public null|array $new_chat_photo = null;
337
+    public null | array $new_chat_photo = null;
338 338
 
339 339
     /** Optional. Service message: the chat photo was deleted */
340
-    public null|bool $delete_chat_photo = null;
340
+    public null | bool $delete_chat_photo = null;
341 341
 
342 342
     /** Optional. Service message: the group has been created */
343
-    public null|bool $group_chat_created = null;
343
+    public null | bool $group_chat_created = null;
344 344
 
345 345
     /**
346 346
      * Optional. Service message: the supergroup has been created. This field can't be received in a message coming
347 347
      * through updates, because bot can't be a member of a supergroup when it is created. It can only be found in
348 348
      * reply_to_message if someone replies to a very first message in a directly created supergroup.
349 349
      */
350
-    public null|bool $supergroup_chat_created = null;
350
+    public null | bool $supergroup_chat_created = null;
351 351
 
352 352
     /**
353 353
      * Optional. Service message: the channel has been created. This field can't be received in a message coming
354 354
      * through updates, because bot can't be a member of a channel when it is created. It can only be found in
355 355
      * reply_to_message if someone replies to a very first message in a channel.
356 356
      */
357
-    public null|bool $channel_chat_created = null;
357
+    public null | bool $channel_chat_created = null;
358 358
 
359 359
     /** Optional. Service message: auto-delete timer settings changed in the chat */
360
-    public null|messageAutoDeleteTimerChanged $message_auto_delete_timer_changed = null;
360
+    public null | messageAutoDeleteTimerChanged $message_auto_delete_timer_changed = null;
361 361
 
362 362
     /**
363 363
      * Optional. The group has been migrated to a supergroup with the specified identifier. This number may have more
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
      * But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for
366 366
      * storing this identifier.
367 367
      */
368
-    public null|int $migrate_to_chat_id = null;
368
+    public null | int $migrate_to_chat_id = null;
369 369
 
370 370
     /**
371 371
      * Optional. The supergroup has been migrated from a group with the specified identifier. This number may have
@@ -373,25 +373,25 @@  discard block
 block discarded – undo
373 373
      * interpreting it. But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float
374 374
      * type are safe for storing this identifier.
375 375
      */
376
-    public null|int $migrate_from_chat_id = null;
376
+    public null | int $migrate_from_chat_id = null;
377 377
 
378 378
     /**
379 379
      * Optional. Specified message was pinned. Note that the Message object in this field will not contain further
380 380
      * reply_to_message fields even if it itself is a reply.
381 381
      */
382
-    public null|maybeInaccessibleMessage $pinned_message = null;
382
+    public null | maybeInaccessibleMessage $pinned_message = null;
383 383
 
384 384
     /** Optional. Message is an invoice for a payment, information about the invoice. More about payments » */
385
-    public null|invoice $invoice = null;
385
+    public null | invoice $invoice = null;
386 386
 
387 387
     /**
388 388
      * Optional. Message is a service message about a successful payment, information about the payment. More about
389 389
      * payments »
390 390
      */
391
-    public null|successfulPayment $successful_payment = null;
391
+    public null | successfulPayment $successful_payment = null;
392 392
 
393 393
     /** Optional. Service message: users were shared with the bot */
394
-    public null|usersShared $users_shared = null;
394
+    public null | usersShared $users_shared = null;
395 395
 
396 396
     /**
397 397
      * Optional. Service message: a user was shared with the bot
@@ -400,86 +400,86 @@  discard block
 block discarded – undo
400 400
      *
401 401
      * @deprecated use users_shared instead
402 402
      */
403
-    public null|userShared $user_shared = null;
403
+    public null | userShared $user_shared = null;
404 404
 
405 405
     /** Optional. Service message: a chat was shared with the bot */
406
-    public null|chatShared $chat_shared = null;
406
+    public null | chatShared $chat_shared = null;
407 407
 
408 408
     /** Optional. The domain name of the website on which the user has logged in. More about Telegram Login » */
409
-    public null|string $connected_website = null;
409
+    public null | string $connected_website = null;
410 410
 
411 411
     /**
412 412
      * Optional. Service message: the user allowed the bot to write messages after adding it to the attachment or
413 413
      * side menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method
414 414
      * requestWriteAccess
415 415
      */
416
-    public null|writeAccessAllowed $write_access_allowed = null;
416
+    public null | writeAccessAllowed $write_access_allowed = null;
417 417
 
418 418
     /** Optional. Telegram Passport data */
419
-    public null|passportData $passport_data = null;
419
+    public null | passportData $passport_data = null;
420 420
 
421 421
     /**
422 422
      * Optional. Service message. A user in the chat triggered another user's proximity alert while sharing Live
423 423
      * Location.
424 424
      */
425
-    public null|proximityAlertTriggered $proximity_alert_triggered = null;
425
+    public null | proximityAlertTriggered $proximity_alert_triggered = null;
426 426
 
427 427
     /** Optional. Service message: user boosted the chat */
428
-    public null|chatBoostAdded $boost_added = null;
428
+    public null | chatBoostAdded $boost_added = null;
429 429
 
430 430
     /** Optional. Service message: chat background set */
431
-    public null|chatBackground $chat_background_set = null;
431
+    public null | chatBackground $chat_background_set = null;
432 432
 
433 433
     /** Optional. Service message: forum topic created */
434
-    public null|forumTopicCreated $forum_topic_created = null;
434
+    public null | forumTopicCreated $forum_topic_created = null;
435 435
 
436 436
     /** Optional. Service message: forum topic edited */
437
-    public null|forumTopicEdited $forum_topic_edited = null;
437
+    public null | forumTopicEdited $forum_topic_edited = null;
438 438
 
439 439
     /** Optional. Service message: forum topic closed */
440
-    public null|forumTopicClosed $forum_topic_closed = null;
440
+    public null | forumTopicClosed $forum_topic_closed = null;
441 441
 
442 442
     /** Optional. Service message: forum topic reopened */
443
-    public null|forumTopicReopened $forum_topic_reopened = null;
443
+    public null | forumTopicReopened $forum_topic_reopened = null;
444 444
 
445 445
     /** Optional. Service message: the 'General' forum topic hidden */
446
-    public null|generalForumTopicHidden $general_forum_topic_hidden = null;
446
+    public null | generalForumTopicHidden $general_forum_topic_hidden = null;
447 447
 
448 448
     /** Optional. Service message: the 'General' forum topic unhidden */
449
-    public null|generalForumTopicUnhidden $general_forum_topic_unhidden = null;
449
+    public null | generalForumTopicUnhidden $general_forum_topic_unhidden = null;
450 450
 
451 451
     /** Optional. Service message: a scheduled giveaway was created */
452
-    public null|giveawayCreated $giveaway_created = null;
452
+    public null | giveawayCreated $giveaway_created = null;
453 453
 
454 454
     /** Optional. The message is a scheduled giveaway message */
455
-    public null|giveaway $giveaway = null;
455
+    public null | giveaway $giveaway = null;
456 456
 
457 457
     /** Optional. A giveaway with public winners was completed */
458
-    public null|giveawayWinners $giveaway_winners = null;
458
+    public null | giveawayWinners $giveaway_winners = null;
459 459
 
460 460
     /** Optional. Service message: a giveaway without public winners was completed */
461
-    public null|giveawayCompleted $giveaway_completed = null;
461
+    public null | giveawayCompleted $giveaway_completed = null;
462 462
 
463 463
     /** Optional. Service message: video chat scheduled */
464
-    public null|videoChatScheduled $video_chat_scheduled = null;
464
+    public null | videoChatScheduled $video_chat_scheduled = null;
465 465
 
466 466
     /** Optional. Service message: video chat started */
467
-    public null|videoChatStarted $video_chat_started = null;
467
+    public null | videoChatStarted $video_chat_started = null;
468 468
 
469 469
     /** Optional. Service message: video chat ended */
470
-    public null|videoChatEnded $video_chat_ended = null;
470
+    public null | videoChatEnded $video_chat_ended = null;
471 471
 
472 472
     /** Optional. Service message: new participants invited to a video chat */
473
-    public null|videoChatParticipantsInvited $video_chat_participants_invited = null;
473
+    public null | videoChatParticipantsInvited $video_chat_participants_invited = null;
474 474
 
475 475
     /** Optional. Service message: data sent by a Web App */
476
-    public null|webAppData $web_app_data = null;
476
+    public null | webAppData $web_app_data = null;
477 477
 
478 478
     /** Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons. */
479
-    public null|inlineKeyboardMarkup $reply_markup = null;
479
+    public null | inlineKeyboardMarkup $reply_markup = null;
480 480
 
481 481
 
482
-    public function __construct(stdClass|null $object = null) {
482
+    public function __construct(stdClass | null $object = null) {
483 483
         if ($object != null) {
484 484
             parent::__construct($object, self::subs);
485 485
 
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
      *
492 492
      * @return bool
493 493
      */
494
-    public function isCommand (): bool {
494
+    public function isCommand(): bool {
495 495
         return !empty($this->command);
496 496
     }
497 497
 
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
      *
501 501
      * @return bool
502 502
      */
503
-    public function isForwarded (): bool {
503
+    public function isForwarded(): bool {
504 504
         return $this->forward_origin !== null;
505 505
     }
506 506
 
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
      *
510 510
      * @return bool
511 511
      */
512
-    public function isReplied (): bool {
512
+    public function isReplied(): bool {
513 513
         return !empty($this->reply_to_message);
514 514
     }
515 515
 
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
      *
521 521
      * @return bool
522 522
      */
523
-    public function isAdmin (): bool {
523
+    public function isAdmin(): bool {
524 524
         return $this->chat->getMember($this->from->id)->status === chatMemberStatus::ADMINISTRATOR;
525 525
     }
526 526
 
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
      *
532 532
      * @return bool
533 533
      */
534
-    public function isOwner (): bool {
534
+    public function isOwner(): bool {
535 535
         return $this->chat->getMember($this->from->id)->status === chatMemberStatus::CREATOR;
536 536
     }
537 537
 
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
      *
545 545
      * @return responseError|bool
546 546
      */
547
-    public function banMember(bool $answer = null): responseError|bool {
547
+    public function banMember(bool $answer = null): responseError | bool {
548 548
         if ($this->chat->isPrivate()) {
549 549
             return false;
550 550
         }
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
      *
561 561
      * @return responseError|bool
562 562
      */
563
-    public function kickMember(bool $answer = null): responseError|bool {
563
+    public function kickMember(bool $answer = null): responseError | bool {
564 564
         if ($this->chat->isPrivate()) {
565 565
             return false;
566 566
         }
@@ -574,8 +574,8 @@  discard block
 block discarded – undo
574 574
      *
575 575
      * @return responseError|bool
576 576
      */
577
-    public function delete (bool $answer = null): responseError|bool {
578
-        return telegram::deleteMessage($this->chat->id,$this->id, answer: $answer);
577
+    public function delete(bool $answer = null): responseError | bool {
578
+        return telegram::deleteMessage($this->chat->id, $this->id, answer: $answer);
579 579
     }
580 580
 
581 581
     /**
@@ -585,8 +585,8 @@  discard block
 block discarded – undo
585 585
      *
586 586
      * @return responseError|bool
587 587
      */
588
-    public function pinChatMessage (bool $answer = null): responseError|bool {
589
-        return telegram::deleteMessage($this->chat->id,$this->id, answer: $answer);
588
+    public function pinChatMessage(bool $answer = null): responseError | bool {
589
+        return telegram::deleteMessage($this->chat->id, $this->id, answer: $answer);
590 590
     }
591 591
 
592 592
     /**
@@ -597,8 +597,8 @@  discard block
 block discarded – undo
597 597
      *
598 598
      * @return message|responseError|bool
599 599
      */
600
-    public function editText (string $text, bool $answer = null): message|responseError|bool {
601
-        return telegram::editMessageText($text,  $this->chat->id, $this->message_id, answer: $answer);
600
+    public function editText(string $text, bool $answer = null): message | responseError | bool {
601
+        return telegram::editMessageText($text, $this->chat->id, $this->message_id, answer: $answer);
602 602
     }
603 603
 
604 604
     /**
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
      *
610 610
      * @return messageId|responseError
611 611
      */
612
-    public function copy (int|string $chat_id, bool $answer = null): messageId|responseError {
612
+    public function copy(int | string $chat_id, bool $answer = null): messageId | responseError {
613 613
         return telegram::copyMessage($chat_id, answer: $answer);
614 614
     }
615 615
 
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
      *
622 622
      * @return message|responseError
623 623
      */
624
-    public function forward (int|string $chat_id, bool $answer = null): message|responseError {
624
+    public function forward(int | string $chat_id, bool $answer = null): message | responseError {
625 625
         return telegram::forwardMessage($chat_id, answer: $answer);
626 626
     }
627 627
 }
Please login to merge, or discard this patch.
src/types/chatFullInfo.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -27,166 +27,166 @@  discard block
 block discarded – undo
27 27
      * languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a
28 28
      * signed 64-bit integer or double-precision float type are safe for storing this identifier.
29 29
      */
30
-    public null|int $id;
30
+    public null | int $id;
31 31
 
32 32
     /** Type of the chat, can be either “private”, “group”, “supergroup” or “channel” */
33
-    public null|string $type;
33
+    public null | string $type;
34 34
 
35 35
     /** Optional. Title, for supergroups, channels and group chats */
36
-    public null|string $title = null;
36
+    public null | string $title = null;
37 37
 
38 38
     /** Optional. Username, for private chats, supergroups and channels if available */
39
-    public null|string $username = null;
39
+    public null | string $username = null;
40 40
 
41 41
     /** Optional. First name of the other party in a private chat */
42
-    public null|string $first_name = null;
42
+    public null | string $first_name = null;
43 43
 
44 44
     /** Optional. Last name of the other party in a private chat */
45
-    public null|string $last_name = null;
45
+    public null | string $last_name = null;
46 46
 
47 47
     /** Optional. True, if the supergroup chat is a forum (has topics enabled) */
48
-    public null|bool $is_forum = null;
48
+    public null | bool $is_forum = null;
49 49
 
50 50
     /**
51 51
      * Identifier of the accent color for the chat name and backgrounds of the chat photo, reply header, and link
52 52
      * preview. See accent colors for more details.
53 53
      */
54
-    public null|int $accent_color_id;
54
+    public null | int $accent_color_id;
55 55
 
56 56
     /** The maximum number of reactions that can be set on a message in the chat */
57
-    public null|int $max_reaction_count;
57
+    public null | int $max_reaction_count;
58 58
 
59 59
     /** Optional. Chat photo */
60
-    public null|chatPhoto $photo = null;
60
+    public null | chatPhoto $photo = null;
61 61
 
62 62
     /**
63 63
      * Optional. If non-empty, the list of all active chat usernames; for private chats, supergroups and channels
64 64
      * @var string[]
65 65
      */
66
-    public null|array $active_usernames = null;
66
+    public null | array $active_usernames = null;
67 67
 
68 68
     /** Optional. For private chats, the date of birth of the user */
69
-    public null|birthdate $birthdate = null;
69
+    public null | birthdate $birthdate = null;
70 70
 
71 71
     /** Optional. For private chats with business accounts, the intro of the business */
72
-    public null|businessIntro $business_intro = null;
72
+    public null | businessIntro $business_intro = null;
73 73
 
74 74
     /** Optional. For private chats with business accounts, the location of the business */
75
-    public null|businessLocation $business_location = null;
75
+    public null | businessLocation $business_location = null;
76 76
 
77 77
     /** Optional. For private chats with business accounts, the opening hours of the business */
78
-    public null|businessOpeningHours $business_opening_hours = null;
78
+    public null | businessOpeningHours $business_opening_hours = null;
79 79
 
80 80
     /** Optional. For private chats, the personal channel of the user */
81
-    public null|chat $personal_chat = null;
81
+    public null | chat $personal_chat = null;
82 82
 
83 83
     /**
84 84
      * Optional. List of available reactions allowed in the chat. If omitted, then all emoji reactions are allowed.
85 85
      * @var reactionType[]
86 86
      */
87
-    public null|array $available_reactions = null;
87
+    public null | array $available_reactions = null;
88 88
 
89 89
     /**
90 90
      * Optional. Custom emoji identifier of the emoji chosen by the chat for the reply header and link preview
91 91
      * background
92 92
      */
93
-    public null|string $background_custom_emoji_id = null;
93
+    public null | string $background_custom_emoji_id = null;
94 94
 
95 95
     /**
96 96
      * Optional. Identifier of the accent color for the chat's profile background. See profile accent colors for more
97 97
      * details.
98 98
      */
99
-    public null|int $profile_accent_color_id = null;
99
+    public null | int $profile_accent_color_id = null;
100 100
 
101 101
     /** Optional. Custom emoji identifier of the emoji chosen by the chat for its profile background */
102
-    public null|string $profile_background_custom_emoji_id = null;
102
+    public null | string $profile_background_custom_emoji_id = null;
103 103
 
104 104
     /** Optional. Custom emoji identifier of the emoji status of the chat or the other party in a private chat */
105
-    public null|string $emoji_status_custom_emoji_id = null;
105
+    public null | string $emoji_status_custom_emoji_id = null;
106 106
 
107 107
     /**
108 108
      * Optional. Expiration date of the emoji status of the chat or the other party in a private chat, in Unix time,
109 109
      * if any
110 110
      */
111
-    public null|int $emoji_status_expiration_date = null;
111
+    public null | int $emoji_status_expiration_date = null;
112 112
 
113 113
     /** Optional. Bio of the other party in a private chat */
114
-    public null|string $bio = null;
114
+    public null | string $bio = null;
115 115
 
116 116
     /**
117 117
      * Optional. True, if privacy settings of the other party in the private chat allows to use
118 118
      * tg://user?id=<user_id> links only in chats with the user
119 119
      */
120
-    public null|bool $has_private_forwards = null;
120
+    public null | bool $has_private_forwards = null;
121 121
 
122 122
     /**
123 123
      * Optional. True, if the privacy settings of the other party restrict sending voice and video note messages in
124 124
      * the private chat
125 125
      */
126
-    public null|bool $has_restricted_voice_and_video_messages = null;
126
+    public null | bool $has_restricted_voice_and_video_messages = null;
127 127
 
128 128
     /** Optional. True, if users need to join the supergroup before they can send messages */
129
-    public null|bool $join_to_send_messages = null;
129
+    public null | bool $join_to_send_messages = null;
130 130
 
131 131
     /**
132 132
      * Optional. True, if all users directly joining the supergroup without using an invite link need to be approved
133 133
      * by supergroup administrators
134 134
      */
135
-    public null|bool $join_by_request = null;
135
+    public null | bool $join_by_request = null;
136 136
 
137 137
     /** Optional. Description, for groups, supergroups and channel chats */
138
-    public null|string $description = null;
138
+    public null | string $description = null;
139 139
 
140 140
     /** Optional. Primary invite link, for groups, supergroups and channel chats */
141
-    public null|string $invite_link = null;
141
+    public null | string $invite_link = null;
142 142
 
143 143
     /** Optional. The most recent pinned message (by sending date) */
144
-    public null|message $pinned_message = null;
144
+    public null | message $pinned_message = null;
145 145
 
146 146
     /** Optional. Default chat member permissions, for groups and supergroups */
147
-    public null|chatPermissions $permissions = null;
147
+    public null | chatPermissions $permissions = null;
148 148
 
149 149
     /**
150 150
      * Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged
151 151
      * user; in seconds
152 152
      */
153
-    public null|int $slow_mode_delay = null;
153
+    public null | int $slow_mode_delay = null;
154 154
 
155 155
     /**
156 156
      * Optional. For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to
157 157
      * ignore slow mode and chat permissions
158 158
      */
159
-    public null|int $unrestrict_boost_count = null;
159
+    public null | int $unrestrict_boost_count = null;
160 160
 
161 161
     /** Optional. The time after which all messages sent to the chat will be automatically deleted; in seconds */
162
-    public null|int $message_auto_delete_time = null;
162
+    public null | int $message_auto_delete_time = null;
163 163
 
164 164
     /**
165 165
      * Optional. True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to
166 166
      * chat administrators.
167 167
      */
168
-    public null|bool $has_aggressive_anti_spam_enabled = null;
168
+    public null | bool $has_aggressive_anti_spam_enabled = null;
169 169
 
170 170
     /** Optional. True, if non-administrators can only get the list of bots and administrators in the chat */
171
-    public null|bool $has_hidden_members = null;
171
+    public null | bool $has_hidden_members = null;
172 172
 
173 173
     /** Optional. True, if messages from the chat can't be forwarded to other chats */
174
-    public null|bool $has_protected_content = null;
174
+    public null | bool $has_protected_content = null;
175 175
 
176 176
     /** Optional. True, if new chat members will have access to old messages = null; available only to chat administrators */
177
-    public null|bool $has_visible_history = null;
177
+    public null | bool $has_visible_history = null;
178 178
 
179 179
     /** Optional. For supergroups, name of the group sticker set */
180
-    public null|string $sticker_set_name = null;
180
+    public null | string $sticker_set_name = null;
181 181
 
182 182
     /** Optional. True, if the bot can change the group sticker set */
183
-    public null|bool $can_set_sticker_set = null;
183
+    public null | bool $can_set_sticker_set = null;
184 184
 
185 185
     /**
186 186
      * Optional. For supergroups, the name of the group's custom emoji sticker set. Custom emoji from this set can be
187 187
      * used by all users and bots in the group.
188 188
      */
189
-    public null|string $custom_emoji_sticker_set_name = null;
189
+    public null | string $custom_emoji_sticker_set_name = null;
190 190
 
191 191
     /**
192 192
      * Optional. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice
@@ -194,13 +194,13 @@  discard block
 block discarded – undo
194 194
      * languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed
195 195
      * 64 bit integer or double-precision float type are safe for storing this identifier.
196 196
      */
197
-    public null|int $linked_chat_id = null;
197
+    public null | int $linked_chat_id = null;
198 198
 
199 199
     /** Optional. For supergroups, the location to which the supergroup is connected */
200
-    public null|chatLocation $location = null;
200
+    public null | chatLocation $location = null;
201 201
 
202 202
 
203
-    public function __construct(stdClass|null $object = null) {
203
+    public function __construct(stdClass | null $object = null) {
204 204
         if ($object != null) {
205 205
             parent::__construct($object, self::subs);
206 206
         }
Please login to merge, or discard this patch.
src/types/chatMemberUpdated.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -38,19 +38,19 @@  discard block
 block discarded – undo
38 38
      * Optional. Chat invite link, which was used by the user to join the chat; for joining by invite link events
39 39
      * only.
40 40
      */
41
-    public null|chatInviteLink $invite_link = null;
41
+    public null | chatInviteLink $invite_link = null;
42 42
 
43 43
     /**
44 44
      * Optional. True, if the user joined the chat after sending a direct join request without using an invite link
45 45
      * and being approved by an administrator
46 46
      */
47
-    public null|bool $via_join_request = null;
47
+    public null | bool $via_join_request = null;
48 48
 
49 49
     /** Optional. True, if the user joined the chat via a chat folder invite link */
50
-    public null|bool $via_chat_folder_invite_link = null;
50
+    public null | bool $via_chat_folder_invite_link = null;
51 51
 
52 52
 
53
-    public function __construct(stdClass|null $object = null) {
53
+    public function __construct(stdClass | null $object = null) {
54 54
         if ($object != null) {
55 55
             parent::__construct($object, self::subs);
56 56
         }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      *
80 80
      * @return bool
81 81
      */
82
-    public function isMe (): bool {
82
+    public function isMe(): bool {
83 83
         return $this->new_chat_member->user->id == settings::$bot_id;
84 84
     }
85 85
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
      *
116 116
      * @return bool
117 117
      */
118
-    public function isLeaved (): bool {
118
+    public function isLeaved(): bool {
119 119
         return $this->new_chat_member->status === chatMemberStatus::LEFT;
120 120
     }
121 121
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      *
125 125
      * @return bool
126 126
      */
127
-    public function isKicked (): bool {
127
+    public function isKicked(): bool {
128 128
         return $this->new_chat_member->status === chatMemberStatus::KICKED;
129 129
     }
130 130
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      *
134 134
      * @return bool
135 135
      */
136
-    public function isOldAdmin (): bool {
136
+    public function isOldAdmin(): bool {
137 137
         return $this->old_chat_member->status === chatMemberStatus::ADMINISTRATOR;
138 138
     }
139 139
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
      *
143 143
      * @return bool
144 144
      */
145
-    public function isNewAdmin (): bool {
145
+    public function isNewAdmin(): bool {
146 146
         return $this->new_chat_member->status === chatMemberStatus::ADMINISTRATOR;
147 147
     }
148 148
 }
Please login to merge, or discard this patch.
src/database/mysql.php 1 patch
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -30,12 +30,12 @@  discard block
 block discarded – undo
30 30
     /**
31 31
      * If you want to use it in standalone mode , you MUST set `auto_process` to `false`
32 32
      */
33
-    public static function init (string $host = 'localhost', string $username = 'root', string $password = '', string $dbname = '', bool $auto_process = true, int $port = 3306, bool $auto_load = false): void {
33
+    public static function init(string $host = 'localhost', string $username = 'root', string $password = '', string $dbname = '', bool $auto_process = true, int $port = 3306, bool $auto_load = false): void {
34 34
         self::$auto_process = $auto_process;
35 35
         self::$db_name = $dbname;
36 36
         self::$connection = new mysqli($host, $username, $password, $dbname, $port);
37 37
         if (self::$connection->connect_errno) {
38
-            logger::write('SQL connection has problem : ' . self::$connection->connect_error, loggerTypes::ERROR);
38
+            logger::write('SQL connection has problem : '.self::$connection->connect_error, loggerTypes::ERROR);
39 39
             throw new bptException('SQL_CONNECTION_PROBLEM');
40 40
         }
41 41
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         }
45 45
     }
46 46
 
47
-    private static function install (bool $auto_load): void {
47
+    private static function install(bool $auto_load): void {
48 48
         if (self::$auto_process) {
49 49
             self::pureQuery("
50 50
 CREATE TABLE `users`
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
             foreach ($allowed_file_names as $allowed_file_name) {
81 81
                 if (file_exists($allowed_file_name)) {
82 82
                     $mysqli->multi_query(file_get_contents($allowed_file_name));
83
-                    while ($mysqli->next_result()){if (!$mysqli->more_results()) break;}
83
+                    while ($mysqli->next_result()) {if (!$mysqli->more_results()) break; }
84 84
                     $loaded = true;
85 85
                 }
86 86
             }
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     /**
95 95
      * @internal Only for BPT self usage , Don't use it in your source!
96 96
      */
97
-    public static function process (): void {
97
+    public static function process(): void {
98 98
         if (self::$auto_process) {
99 99
             if (isset(BPT::$update->message)) {
100 100
                 self::processMessage(BPT::$update->message);
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         }
115 115
     }
116 116
 
117
-    private static function processMessage (message $update): void {
117
+    private static function processMessage(message $update): void {
118 118
         $type = $update->chat->type;
119 119
         if ($type === chatType::PRIVATE) {
120 120
             $user_id = $update->from->id;
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
         }
141 141
     }
142 142
 
143
-    private static function processCallbackQuery (callbackQuery $update): void {
143
+    private static function processCallbackQuery(callbackQuery $update): void {
144 144
         $type = $update->message->chat->type;
145 145
         if ($type === chatType::PRIVATE) {
146 146
             $user_id = $update->from->id;
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
         }
151 151
     }
152 152
 
153
-    private static function processInlineQuery (inlineQuery $update): void {
153
+    private static function processInlineQuery(inlineQuery $update): void {
154 154
         $type = $update->chat_type;
155 155
         if ($type === chatType::PRIVATE || $type === chatType::SENDER) {
156 156
             $user_id = $update->from->id;
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
         }
161 161
     }
162 162
 
163
-    private static function processMyChatMember (chatMemberUpdated $update): void {
163
+    private static function processMyChatMember(chatMemberUpdated $update): void {
164 164
         $type = $update->chat->type;
165 165
         if ($type === chatType::PRIVATE) {
166 166
             if ($update->new_chat_member->status === chatMemberStatus::MEMBER) {
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
      *
184 184
      * @return bool
185 185
      */
186
-    public static function addDefaultWhere (array $where): bool {
186
+    public static function addDefaultWhere(array $where): bool {
187 187
         if (empty(self::$default_where)) {
188 188
             self::$default_where = $where;
189 189
         }
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
      *
199 199
      * @return mysqli
200 200
      */
201
-    public static function getMysqli (): mysqli|false {
201
+    public static function getMysqli(): mysqli | false {
202 202
         return self::$connection ?? false;
203 203
     }
204 204
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
      *
210 210
      * @return int|string
211 211
      */
212
-    public static function affected_rows (): int|string {
212
+    public static function affected_rows(): int | string {
213 213
         return self::$connection->affected_rows;
214 214
     }
215 215
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
      *
221 221
      * @return int|string
222 222
      */
223
-    public static function affectedRows (): int|string {
223
+    public static function affectedRows(): int | string {
224 224
         return self::$connection->affected_rows;
225 225
     }
226 226
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
      *
232 232
      * @return int|string
233 233
      */
234
-    public static function insert_id (): int|string {
234
+    public static function insert_id(): int | string {
235 235
         return self::$connection->insert_id;
236 236
     }
237 237
 
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
      *
243 243
      * @return int|string
244 244
      */
245
-    public static function insertId (): int|string {
245
+    public static function insertId(): int | string {
246 246
         return self::$connection->insert_id;
247 247
     }
248 248
 
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
      *
254 254
      * @return string
255 255
      */
256
-    public static function escapeString (string $text): string {
256
+    public static function escapeString(string $text): string {
257 257
         return self::$connection->real_escape_string($text);
258 258
     }
259 259
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
      *
263 263
      * @return string
264 264
      */
265
-    public static function error (): string {
265
+    public static function error(): string {
266 266
         return self::$connection->error;
267 267
     }
268 268
 
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
      *
272 272
      * @return int
273 273
      */
274
-    public static function errno (): int {
274
+    public static function errno(): int {
275 275
         return self::$connection->errno;
276 276
     }
277 277
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
      *
283 283
      * @return bool
284 284
      */
285
-    public static function setCharset (string $charset): bool {
285
+    public static function setCharset(string $charset): bool {
286 286
         return self::$connection->set_charset($charset);
287 287
     }
288 288
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
      *
298 298
      * @return mysqli_result|bool
299 299
      */
300
-    public static function pureQuery (string $query): mysqli_result|bool {
300
+    public static function pureQuery(string $query): mysqli_result | bool {
301 301
         return self::$connection->query($query);
302 302
     }
303 303
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
      *
319 319
      * @return mysqli_result|bool
320 320
      */
321
-    public static function query (string $query, array $vars = [], bool $need_result = true): mysqli_result|bool {
321
+    public static function query(string $query, array $vars = [], bool $need_result = true): mysqli_result | bool {
322 322
         if (empty($vars)) {
323 323
             return self::pureQuery($query);
324 324
         }
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
                 $types .= 's';
336 336
             }
337 337
         }
338
-        $prepare->bind_param($types,...$vars);
338
+        $prepare->bind_param($types, ...$vars);
339 339
         if (!$prepare->execute()) {
340 340
             logger::write(loggerTypes::WARNING, $prepare->error);
341 341
             return false;
@@ -382,8 +382,8 @@  discard block
 block discarded – undo
382 382
                 else {
383 383
                     $query .= ' AND';
384 384
                 }
385
-                $operator = substr($sub_value,0,2);
386
-                $operator_value = substr($sub_value,2);
385
+                $operator = substr($sub_value, 0, 2);
386
+                $operator_value = substr($sub_value, 2);
387 387
                 switch ($operator) {
388 388
                     case '>=':
389 389
                         $query .= " `$name` >= ?";
@@ -410,8 +410,8 @@  discard block
 block discarded – undo
410 410
                         $sub_value = $operator_value;
411 411
                         break;
412 412
                     case '##':
413
-                        $operator = substr($operator_value,0,2);
414
-                        $column = substr($operator_value,2);
413
+                        $operator = substr($operator_value, 0, 2);
414
+                        $column = substr($operator_value, 2);
415 415
                         $query .= match ($operator) {
416 416
                             '>=' => " `$name` >= `$column`",
417 417
                             '<=' => " `$name` <= `$column`",
@@ -435,17 +435,17 @@  discard block
 block discarded – undo
435 435
         return $values;
436 436
     }
437 437
 
438
-    private static function groupByBuilder(string &$query, string|array $group_by = []): void {
438
+    private static function groupByBuilder(string &$query, string | array $group_by = []): void {
439 439
         if (empty($group_by)) {
440 440
             return;
441 441
         }
442 442
         if (is_string($group_by)) {
443 443
             $group_by = [$group_by];
444 444
         }
445
-        $query .= ' GROUP BY `' . implode('`, `',$group_by) . '`';
445
+        $query .= ' GROUP BY `'.implode('`, `', $group_by).'`';
446 446
     }
447 447
 
448
-    private static function orderByBuilder(string &$query, string|array $order_by = []): void {
448
+    private static function orderByBuilder(string &$query, string | array $order_by = []): void {
449 449
         if (empty($order_by)) {
450 450
             return;
451 451
         }
@@ -498,8 +498,8 @@  discard block
 block discarded – undo
498 498
                 continue;
499 499
             }
500 500
 
501
-            $operator = substr($value,0,2);
502
-            $operator_value = substr($value,2);
501
+            $operator = substr($value, 0, 2);
502
+            $operator_value = substr($value, 2);
503 503
             switch ($operator) {
504 504
                 case '+=':
505 505
                     $query .= " `$name` = `$name` + ?";
@@ -532,14 +532,14 @@  discard block
 block discarded – undo
532 532
         return $values;
533 533
     }
534 534
 
535
-    private static function insertBuilder(string &$query, string|array $columns, array|string $values): array {
536
-        $query .= '(`' . (is_string($columns) ? $columns : implode('`, `', $columns)) . '`) VALUES (';
535
+    private static function insertBuilder(string &$query, string | array $columns, array | string $values): array {
536
+        $query .= '(`'.(is_string($columns) ? $columns : implode('`, `', $columns)).'`) VALUES (';
537 537
         if (is_string($values)) $values = [$values];
538
-        $query .= '?' . str_repeat(', ?', count($values) - 1) . ')';
538
+        $query .= '?'.str_repeat(', ?', count($values) - 1).')';
539 539
         return $values;
540 540
     }
541 541
 
542
-    private static function selectBuilder (string &$query, string|array $columns): void {
542
+    private static function selectBuilder(string &$query, string | array $columns): void {
543 543
         if ($columns == '*') {
544 544
             $query .= ' * ';
545 545
             return;
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
                     $formatted = '*';
559 559
                     $column = 'all';
560 560
                 }
561
-                $query .= strtoupper($function) . "($formatted) as `{$function}_$column`";
561
+                $query .= strtoupper($function)."($formatted) as `{$function}_$column`";
562 562
             }
563 563
             else {
564 564
                 $query .= "`$column`";
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
      *
585 585
      * @return bool
586 586
      */
587
-    public static function delete (string $table, array $where = [], int $count = null, int $offset = null, bool $ignore_default_where = false): bool {
587
+    public static function delete(string $table, array $where = [], int $count = null, int $offset = null, bool $ignore_default_where = false): bool {
588 588
         $query = "DELETE FROM `$table`";
589 589
         $vars = self::whereBuilder($query, $where, $ignore_default_where);
590 590
         self::countBuilder($query, $count, $offset);
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
      *
606 606
      * @return bool
607 607
      */
608
-    public static function update (string $table, array $modify, array $where = [], int $count = null, int $offset = null, bool $ignore_default_where = false): bool {
608
+    public static function update(string $table, array $modify, array $where = [], int $count = null, int $offset = null, bool $ignore_default_where = false): bool {
609 609
         $query = "UPDATE `$table` SET";
610 610
         $modify_vars = self::updateBuilder($query, $modify);
611 611
         $where_vars = self::whereBuilder($query, $where, $ignore_default_where);
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
      *
625 625
      * @return bool
626 626
      */
627
-    public static function insert (string $table, string|array $columns, array|string $values): bool {
627
+    public static function insert(string $table, string | array $columns, array | string $values): bool {
628 628
         $query = "INSERT INTO `$table`";
629 629
         $values = self::insertBuilder($query, $columns, $values);
630 630
         return self::query($query, $values, false);
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
      *
641 641
      * @return bool
642 642
      */
643
-    public static function multiInsert (string $table, array ...$inserts): bool {
643
+    public static function multiInsert(string $table, array ...$inserts): bool {
644 644
         $all_letters = true;
645 645
         foreach ($inserts as $insert) {
646 646
             foreach ($insert as $column => $value) {
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
         if ($all_letters) {
655 655
             sort($columns);
656 656
         }
657
-        $query = "INSERT INTO `$table`(`" . '' . (is_string($columns) ? $columns : implode('`, `', $columns)) . '`) VALUES';
657
+        $query = "INSERT INTO `$table`(`".''.(is_string($columns) ? $columns : implode('`, `', $columns)).'`) VALUES';
658 658
 
659 659
         $all_values = [];
660 660
         foreach ($inserts as $key => $insert) {
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
                 asort($insert);
663 663
             }
664 664
             $values = array_values($insert);
665
-            $query .= ($key != 0 ? ',' : '') . ' (?' . str_repeat(', ?', count($values) - 1) . ')';
665
+            $query .= ($key != 0 ? ',' : '').' (?'.str_repeat(', ?', count($values) - 1).')';
666 666
             $all_values = array_merge($all_values, $values);
667 667
         }
668 668
         return self::query($query, $all_values, false);
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
      *
686 686
      * @return bool
687 687
      */
688
-    public static function insertUpdate (string $table, string|array $columns, array|string $values, array $modify): bool {
688
+    public static function insertUpdate(string $table, string | array $columns, array | string $values, array $modify): bool {
689 689
         $query = "INSERT INTO `$table`";
690 690
         $values = self::insertBuilder($query, $columns, $values);
691 691
         $query .= ' ON DUPLICATE KEY UPDATE';
@@ -711,14 +711,14 @@  discard block
 block discarded – undo
711 711
      *
712 712
      * @return mysqli_result|bool
713 713
      */
714
-    public static function select (string $table, array|string $columns = '*', array $where = [], int $count = null, int $offset = null, array|string $group_by = [], array|string $order_by = [], bool $ignore_default_where = false): mysqli_result|bool {
714
+    public static function select(string $table, array | string $columns = '*', array $where = [], int $count = null, int $offset = null, array | string $group_by = [], array | string $order_by = [], bool $ignore_default_where = false): mysqli_result | bool {
715 715
         $query = 'SELECT';
716 716
         self::selectBuilder($query, $columns);
717 717
         $query .= "FROM `$table`";
718
-        $var = self::whereBuilder($query,$where, $ignore_default_where);
718
+        $var = self::whereBuilder($query, $where, $ignore_default_where);
719 719
         self::groupByBuilder($query, $group_by);
720 720
         self::orderByBuilder($query, $order_by);
721
-        self::countBuilder($query,$count,$offset);
721
+        self::countBuilder($query, $count, $offset);
722 722
         return self::query($query, $var);
723 723
     }
724 724
 
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
      *
737 737
      * @return null|bool|array
738 738
      */
739
-    public static function selectArray (string $table, array|string $columns = '*', array $where = [], array|string $group_by = [], array|string $order_by = [], bool $ignore_default_where = false): bool|array|null {
739
+    public static function selectArray(string $table, array | string $columns = '*', array $where = [], array | string $group_by = [], array | string $order_by = [], bool $ignore_default_where = false): bool | array | null {
740 740
         $res = self::select($table, $columns, $where, 1, 0, $group_by, $order_by, ignore_default_where: $ignore_default_where);
741 741
         if ($res) {
742 742
             return $res->fetch_assoc();
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
      *
759 759
      * @return null|object
760 760
      */
761
-    public static function selectObject (string $table, array|string $columns = '*', array $where = [], array|string $group_by = [], array|string $order_by = [], bool $ignore_default_where = false) {
761
+    public static function selectObject(string $table, array | string $columns = '*', array $where = [], array | string $group_by = [], array | string $order_by = [], bool $ignore_default_where = false) {
762 762
         $res = self::select($table, $columns, $where, 1, 0, $group_by, $order_by, ignore_default_where: $ignore_default_where);
763 763
         if ($res) {
764 764
             return $res->fetch_object();
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
      *
784 784
      * @return bool|Generator
785 785
      */
786
-    public static function selectEach (string $table, array|string $columns = '*', array $where = [], int $count = null, int $offset = null, array|string $group_by = [], array|string $order_by = [], bool $ignore_default_where = false): bool|Generator {
786
+    public static function selectEach(string $table, array | string $columns = '*', array $where = [], int $count = null, int $offset = null, array | string $group_by = [], array | string $order_by = [], bool $ignore_default_where = false): bool | Generator {
787 787
         $res = self::select($table, $columns, $where, $count, $offset, $group_by, $order_by, ignore_default_where: $ignore_default_where);
788 788
         if ($res) {
789 789
             while ($row = $res->fetch_assoc()) yield $row;
@@ -801,10 +801,10 @@  discard block
 block discarded – undo
801 801
      *
802 802
      * @return string if save is true , return file name otherwise return sql data
803 803
      */
804
-    public static function backup (array $wanted_tables = [], bool $table_data = true, bool $save = true, string $file_name = ''): string {
804
+    public static function backup(array $wanted_tables = [], bool $table_data = true, bool $save = true, string $file_name = ''): string {
805 805
         self::setCharset('utf8mb4');
806 806
 
807
-        $tables = array_column(self::query('SHOW TABLES')->fetch_all(),0);
807
+        $tables = array_column(self::query('SHOW TABLES')->fetch_all(), 0);
808 808
         if (!empty($wanted_tables)) {
809 809
             $tables = array_intersect($tables, $wanted_tables);
810 810
         }
@@ -815,12 +815,12 @@  discard block
 block discarded – undo
815 815
             logger::write('No table founded for backup, if your database has table : check $wanted_tables argument', loggerTypes::WARNING);
816 816
         }
817 817
         foreach ($tables as $table) {
818
-            $sql .= self::query("SHOW CREATE TABLE `$table`")->fetch_row()[1] . ";\n\n";
818
+            $sql .= self::query("SHOW CREATE TABLE `$table`")->fetch_row()[1].";\n\n";
819 819
             if ($table_data) {
820 820
                 $total_rows = self::query("SELECT COUNT(*) as `cnt` FROM `$table`")->fetch_object()->cnt;
821 821
                 for ($i = 0; $i < $total_rows; $i = $i + 1000) {
822
-                    $sql .= 'INSERT INTO ' . $table . ' VALUES';
823
-                    $result = self::select($table, '*' , [], 1000, $i);
822
+                    $sql .= 'INSERT INTO '.$table.' VALUES';
823
+                    $result = self::select($table, '*', [], 1000, $i);
824 824
                     $field_count = $result->field_count;
825 825
                     $affected_rows = self::affected_rows();
826 826
                     $counter = 1;
@@ -828,12 +828,12 @@  discard block
 block discarded – undo
828 828
                         $sql .= "\n(";
829 829
                         for ($column = 0; $column < $field_count; $column++) {
830 830
                             $row[$column] = str_replace("\n", "\\n", addslashes($row[$column]));
831
-                            $sql .= !empty($row[$column]) ? '"' . $row[$column] . '"' : '""';
831
+                            $sql .= !empty($row[$column]) ? '"'.$row[$column].'"' : '""';
832 832
                             if ($column < $field_count - 1) {
833 833
                                 $sql .= ',';
834 834
                             }
835 835
                         }
836
-                        $sql .= ')' . ($counter == $affected_rows ? ';' : ',');
836
+                        $sql .= ')'.($counter == $affected_rows ? ';' : ',');
837 837
                         $counter++;
838 838
                     }
839 839
                 }
@@ -849,7 +849,7 @@  discard block
 block discarded – undo
849 849
         }
850 850
 
851 851
         if (empty($file_name)) {
852
-            $file_name = self::$db_name . time() . '.sql';
852
+            $file_name = self::$db_name.time().'.sql';
853 853
         }
854 854
         file_put_contents($file_name, $sql);
855 855
         return $file_name;
Please login to merge, or discard this patch.