Passed
Push — main ( 95c480...ee195b )
by Miaad
01:34
created
src/types/file.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,19 +31,19 @@
 block discarded – undo
31 31
      * difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit
32 32
      * integer or double-precision float type are safe for storing this value.
33 33
      */
34
-    public null|int $file_size = null;
34
+    public null | int $file_size = null;
35 35
 
36 36
     /** Optional. File path. Use https://api.telegram.org/file/bot<token>/<file_path> to get the file. */
37
-    public null|string $file_path = null;
37
+    public null | string $file_path = null;
38 38
 
39 39
 
40
-    public function __construct(stdClass|null $object = null) {
40
+    public function __construct(stdClass | null $object = null) {
41 41
         if ($object != null) {
42 42
             parent::__construct($object, self::subs);
43 43
         }
44 44
     }
45 45
 
46 46
     public function link(): string {
47
-        return settings::$down_url . 'bot' . settings::$token . '/' . $this->file_path;
47
+        return settings::$down_url.'bot'.settings::$token.'/'.$this->file_path;
48 48
     }
49 49
 }
Please login to merge, or discard this patch.
src/types/voice.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,17 +25,17 @@  discard block
 block discarded – undo
25 25
     public int $duration;
26 26
 
27 27
     /** Optional. MIME type of the file as defined by sender */
28
-    public null|string $mime_type = null;
28
+    public null | string $mime_type = null;
29 29
 
30 30
     /**
31 31
      * Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have
32 32
      * difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit
33 33
      * integer or double-precision float type are safe for storing this value.
34 34
      */
35
-    public null|int $file_size = null;
35
+    public null | int $file_size = null;
36 36
 
37 37
 
38
-    public function __construct(stdClass|null $object = null) {
38
+    public function __construct(stdClass | null $object = null) {
39 39
         if ($object != null) {
40 40
             parent::__construct($object, self::subs);
41 41
         }
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
      *
57 57
      * @return bool|string string will be returned when destination doesn't set
58 58
      */
59
-    public function download(string|null $destination = null): bool|string {
60
-        return telegram::downloadFile($destination ?? 'unknown.ogg',$this->file_id);
59
+    public function download(string | null $destination = null): bool | string {
60
+        return telegram::downloadFile($destination ?? 'unknown.ogg', $this->file_id);
61 61
     }
62 62
 
63 63
     public function link(): string {
Please login to merge, or discard this patch.
src/types/videoNote.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,13 +28,13 @@  discard block
 block discarded – undo
28 28
     public int $duration;
29 29
 
30 30
     /** Optional. Video thumbnail */
31
-    public null|photoSize $thumb = null;
31
+    public null | photoSize $thumb = null;
32 32
 
33 33
     /** Optional. File size in bytes */
34
-    public null|int $file_size = null;
34
+    public null | int $file_size = null;
35 35
 
36 36
 
37
-    public function __construct(stdClass|null $object = null) {
37
+    public function __construct(stdClass | null $object = null) {
38 38
         if ($object != null) {
39 39
             parent::__construct($object, self::subs);
40 40
         }
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
      *
56 56
      * @return bool|string string will be returned when destination doesn't set
57 57
      */
58
-    public function download(string|null $destination = null): bool|string {
59
-        return telegram::downloadFile($destination ?? 'unknown.mp4',$this->file_id);
58
+    public function download(string | null $destination = null): bool | string {
59
+        return telegram::downloadFile($destination ?? 'unknown.mp4', $this->file_id);
60 60
     }
61 61
 
62 62
     public function link(): string {
Please login to merge, or discard this patch.
src/types/document.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -22,23 +22,23 @@  discard block
 block discarded – undo
22 22
     public string $file_unique_id;
23 23
 
24 24
     /** Optional. Document thumbnail as defined by sender */
25
-    public null|photoSize $thumb = null;
25
+    public null | photoSize $thumb = null;
26 26
 
27 27
     /** Optional. Original filename as defined by sender */
28
-    public null|string $file_name = null;
28
+    public null | string $file_name = null;
29 29
 
30 30
     /** Optional. MIME type of the file as defined by sender */
31
-    public null|string $mime_type = null;
31
+    public null | string $mime_type = null;
32 32
 
33 33
     /**
34 34
      * Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have
35 35
      * difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit
36 36
      * integer or double-precision float type are safe for storing this value.
37 37
      */
38
-    public null|int $file_size = null;
38
+    public null | int $file_size = null;
39 39
 
40 40
 
41
-    public function __construct(stdClass|null $object = null) {
41
+    public function __construct(stdClass | null $object = null) {
42 42
         if ($object != null) {
43 43
             parent::__construct($object, self::subs);
44 44
         }
@@ -59,8 +59,8 @@  discard block
 block discarded – undo
59 59
      *
60 60
      * @return bool|string string will be returned when destination doesn't set
61 61
      */
62
-    public function download(string|null $destination = null): bool|string {
63
-        return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.txt',$this->file_id);
62
+    public function download(string | null $destination = null): bool | string {
63
+        return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.txt', $this->file_id);
64 64
     }
65 65
 
66 66
     public function link(): string {
Please login to merge, or discard this patch.
src/logger.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
     /**
18 18
      * @internal Only for BPT self usage , Don't use it in your source!
19 19
      */
20
-    public static function init (int $log_size = 10): void {
20
+    public static function init(int $log_size = 10): void {
21 21
         self::$log_size = $log_size;
22 22
         $log_file = realpath(settings::$name.'BPT.log');
23 23
         if (file_exists($log_file) && !(filesize($log_file) > self::$log_size * 1024 * 1024)) {
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
         self::$handler = fopen($log_file, $mode);
32 32
 
33 33
         if ($write) {
34
-            fwrite(self::$handler,"♥♥♥♥♥♥♥♥♥♥♥♥♥♥ BPT Library  ♥♥♥♥♥♥♥♥♥♥♥♥♥♥\nTnx for using our library\nSome information about us :\nAuthor : @Im_Miaad\nHelper : @A_LiReza_ME\nChannel : @BPT_CH\nOur Website : https://bptlib.ir\n\nIf you have any problem with our library\nContact to our supports\n♥♥♥♥♥♥♥♥♥♥♥♥♥♥ BPT Library  ♥♥♥♥♥♥♥♥♥♥♥♥♥♥\nINFO : BPT Library LOG STARTED ...\nwarning : this file automatically deleted when its size reached log_size setting, do not delete it manually\n\n");
34
+            fwrite(self::$handler, "♥♥♥♥♥♥♥♥♥♥♥♥♥♥ BPT Library  ♥♥♥♥♥♥♥♥♥♥♥♥♥♥\nTnx for using our library\nSome information about us :\nAuthor : @Im_Miaad\nHelper : @A_LiReza_ME\nChannel : @BPT_CH\nOur Website : https://bptlib.ir\n\nIf you have any problem with our library\nContact to our supports\n♥♥♥♥♥♥♥♥♥♥♥♥♥♥ BPT Library  ♥♥♥♥♥♥♥♥♥♥♥♥♥♥\nINFO : BPT Library LOG STARTED ...\nwarning : this file automatically deleted when its size reached log_size setting, do not delete it manually\n\n");
35 35
         }
36 36
 
37 37
         if (self::$waited_logs != []) {
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      * @return void
53 53
      */
54 54
     public static function write(string $data, string $type = loggerTypes::NONE): void {
55
-        $text = date('Y/m/d H:i:s') . ( $type === loggerTypes::NONE ? " : $data\n\n" : " : ⤵\n$type : $data\n\n" );
55
+        $text = date('Y/m/d H:i:s').($type === loggerTypes::NONE ? " : $data\n\n" : " : ⤵\n$type : $data\n\n");
56 56
         if (!is_null(self::$handler)) {
57 57
             fwrite(self::$handler, $text);
58 58
         }
Please login to merge, or discard this patch.
src/receiver/webhook.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
     /**
21 21
      * @internal Only for BPT self usage , Don't use it in your source!
22 22
      */
23
-    public static function init () {
23
+    public static function init() {
24 24
         if (settings::$multi) {
25 25
             multi::init();
26 26
         }
@@ -49,24 +49,24 @@  discard block
 block discarded – undo
49 49
         }
50 50
     }
51 51
 
52
-    protected static function setWebhook(string $url,string $secret = '') {
52
+    protected static function setWebhook(string $url, string $secret = '') {
53 53
         $res = telegram::setWebhook($url, settings::$certificate, max_connections: settings::$max_connection, allowed_updates: settings::$allowed_updates, drop_pending_updates: settings::$skip_old_updates, secret_token: $secret);
54 54
         if (!telegram::$status) {
55
-            logger::write("There is some problem happened , telegram response : \n".json_encode($res),loggerTypes::ERROR);
56
-            BPT::exit(print_r($res,true));
55
+            logger::write("There is some problem happened , telegram response : \n".json_encode($res), loggerTypes::ERROR);
56
+            BPT::exit(print_r($res, true));
57 57
         }
58
-        logger::write('Webhook was set successfully',loggerTypes::INFO);
58
+        logger::write('Webhook was set successfully', loggerTypes::INFO);
59 59
     }
60 60
 
61 61
     protected static function checkURL() {
62 62
         if (!(isset($_SERVER['SERVER_NAME']) && isset($_SERVER['REQUEST_URI']))) {
63
-            logger::write('For using webhook receiver , you should open this file in your webserver(by domain)',loggerTypes::ERROR);
63
+            logger::write('For using webhook receiver , you should open this file in your webserver(by domain)', loggerTypes::ERROR);
64 64
             throw new bptException('WEBHOOK_NEED_URL');
65 65
         }
66 66
     }
67 67
 
68 68
     private static function setURL(): string {
69
-        return (isset(settings::$certificate) ? 'http://' : 'https://') . $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME'];
69
+        return (isset(settings::$certificate) ? 'http://' : 'https://').$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'];
70 70
     }
71 71
 
72 72
     protected static function setCertificate() {
@@ -89,15 +89,15 @@  discard block
 block discarded – undo
89 89
         self::setCertificate();
90 90
         $url = self::setURL();
91 91
         $secret = !empty(settings::$secret) ? settings::$secret : tools::randomString(64);
92
-        self::setWebhook($url,$secret);
93
-        lock::save('BPT-HOOK',$secret);
92
+        self::setWebhook($url, $secret);
93
+        lock::save('BPT-HOOK', $secret);
94 94
         BPT::exit('Done');
95 95
     }
96 96
 
97 97
     private static function checkSecret() {
98 98
         $secret = lock::read('BPT-HOOK');
99 99
         if ($secret !== self::getSecret()) {
100
-            logger::write('This is not webhook set by BPT, webhook will reset',loggerTypes::WARNING);
100
+            logger::write('This is not webhook set by BPT, webhook will reset', loggerTypes::WARNING);
101 101
             self::processSetWebhook();
102 102
         }
103 103
     }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
      *
116 116
      * @return bool
117 117
      */
118
-    public static function fastClose (int $timeout = 86400): bool {
118
+    public static function fastClose(int $timeout = 86400): bool {
119 119
         if (settings::$multi || !lock::exist('BPT-HOOK')) {
120 120
             return false;
121 121
         }
Please login to merge, or discard this patch.
src/receiver/getUpdates.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,24 +16,24 @@  discard block
 block discarded – undo
16 16
  */
17 17
 class getUpdates extends receiver {
18 18
     #[NoReturn]
19
-    public static function init () {
19
+    public static function init() {
20 20
         $last_update_id = self::loadData();
21 21
         lock::set('getUpdateHook');
22
-        while(true) {
22
+        while (true) {
23 23
             if (lock::exist('getUpdateHook')) {
24
-                $updates = telegram::getUpdates($last_update_id,allowed_updates: settings::$allowed_updates);
24
+                $updates = telegram::getUpdates($last_update_id, allowed_updates: settings::$allowed_updates);
25 25
                 if (!telegram::$status) {
26
-                    logger::write("There is some problem happened , telegram response : \n".json_encode($updates),loggerTypes::ERROR);
27
-                    BPT::exit(print_r($updates,true));
26
+                    logger::write("There is some problem happened , telegram response : \n".json_encode($updates), loggerTypes::ERROR);
27
+                    BPT::exit(print_r($updates, true));
28 28
                 }
29 29
                 self::handleUpdates($updates);
30
-                lock::save('getUpdate',BPT::$update->update_id+1);
31
-                $last_update_id = BPT::$update->update_id+1;
30
+                lock::save('getUpdate', BPT::$update->update_id + 1);
31
+                $last_update_id = BPT::$update->update_id + 1;
32 32
             }
33 33
         }
34 34
     }
35 35
 
36
-    private static function loadData(): bool|int|string {
36
+    private static function loadData(): bool | int | string {
37 37
         if (lock::exist('getUpdate')) {
38 38
             $last_update_id = lock::read('getUpdate');
39 39
         }
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
             self::deleteOldLocks();
42 42
             telegram::deleteWebhook();
43 43
             $last_update_id = 0;
44
-            lock::save('getUpdate',0);
44
+            lock::save('getUpdate', 0);
45 45
         }
46 46
         return $last_update_id;
47 47
     }
Please login to merge, or discard this patch.
src/pay/pay.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 use BPT\settings;
6 6
 
7 7
 class pay {
8
-    public static function init (): void {
8
+    public static function init(): void {
9 9
         if (!isset(settings::$pay['crypto'])) {
10 10
             return;
11 11
         }
Please login to merge, or discard this patch.
src/database/db.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
     /**
18 18
      * @internal Only for BPT self usage , Don't use it in your source!
19 19
      */
20
-    public static function init (): void {
20
+    public static function init(): void {
21 21
         if (!isset(settings::$db['type'])) {
22 22
             settings::$db['type'] = dbTypes::JSON;
23 23
         }
Please login to merge, or discard this patch.