Passed
Push — main ( e7b3ac...e48c60 )
by Miaad
01:34
created
src/types/shippingAddress.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
     public string $post_code;
31 31
 
32 32
 
33
-    public function __construct(stdClass|null $object = null) {
33
+    public function __construct(stdClass | null $object = null) {
34 34
         if ($object != null) {
35 35
             parent::__construct($object, self::subs);
36 36
         }
Please login to merge, or discard this patch.
src/types/encryptedPassportElement.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@
 block discarded – undo
79 79
     public string $hash;
80 80
 
81 81
 
82
-    public function __construct(stdClass|null $object = null) {
82
+    public function __construct(stdClass | null $object = null) {
83 83
         if ($object != null) {
84 84
             parent::__construct($object, self::subs);
85 85
         }
Please login to merge, or discard this patch.
src/types/webhookInfo.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
     public array $allowed_updates;
49 49
 
50 50
 
51
-    public function __construct(stdClass|null $object = null) {
51
+    public function __construct(stdClass | null $object = null) {
52 52
         if ($object != null) {
53 53
             parent::__construct($object, self::subs);
54 54
         }
Please login to merge, or discard this patch.
src/types/orderInfo.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
     public shippingAddress $shipping_address;
25 25
 
26 26
 
27
-    public function __construct(stdClass|null $object = null) {
27
+    public function __construct(stdClass | null $object = null) {
28 28
         if ($object != null) {
29 29
             parent::__construct($object, self::subs);
30 30
         }
Please login to merge, or discard this patch.
src/types/videoChatEnded.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
     public int $duration;
54 54
 
55 55
 
56
-    public function __construct(stdClass|null $object = null) {
56
+    public function __construct(stdClass | null $object = null) {
57 57
         if ($object != null) {
58 58
             parent::__construct($object, self::subs);
59 59
         }
Please login to merge, or discard this patch.
src/types/gameHighScore.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
     public int $score;
22 22
 
23 23
 
24
-    public function __construct(stdClass|null $object = null) {
24
+    public function __construct(stdClass | null $object = null) {
25 25
         if ($object != null) {
26 26
             parent::__construct($object, self::subs);
27 27
         }
Please login to merge, or discard this patch.
src/types/inputMedia.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      * be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the
53 53
      * thumbnail was uploaded using multipart/form-data under <file_attach_name>.
54 54
      */
55
-    public CURLFile|string $thumb;
55
+    public CURLFile | string $thumb;
56 56
 
57 57
     /** `video` and `animation` only. width */
58 58
     public int $width;
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     public bool $disable_content_type_detection;
80 80
 
81 81
 
82
-    public function __construct(stdClass|null $object = null) {
82
+    public function __construct(stdClass | null $object = null) {
83 83
         if ($object != null) {
84 84
             parent::__construct($object, self::subs);
85 85
         }
Please login to merge, or discard this patch.
src/tools/encrypt.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      * @return string|bool|array{hash:string, key:string, iv:string}
30 30
      * @throws bptException
31 31
      */
32
-    public static function crypto (string $action, string $text, string $key = null, string $iv = null): bool|array|string {
32
+    public static function crypto(string $action, string $text, string $key = null, string $iv = null): bool | array | string {
33 33
         if (extension_loaded('openssl')) {
34 34
             if ($action === cryptoAction::ENCRYPT) {
35 35
                 $key = self::randomString(64);
@@ -39,22 +39,22 @@  discard block
 block discarded – undo
39 39
             }
40 40
             elseif ($action === cryptoAction::DECRYPT) {
41 41
                 if (empty($key)) {
42
-                    logger::write("tools::crypto function used\nkey parameter is not set",loggerTypes::ERROR);
42
+                    logger::write("tools::crypto function used\nkey parameter is not set", loggerTypes::ERROR);
43 43
                     throw new bptException('ARGUMENT_NOT_FOUND_KEY');
44 44
                 }
45 45
                 elseif (empty($iv)) {
46
-                    logger::write("tools::crypto function used\niv parameter is not set",loggerTypes::ERROR);
46
+                    logger::write("tools::crypto function used\niv parameter is not set", loggerTypes::ERROR);
47 47
                     throw new bptException('ARGUMENT_NOT_FOUND_IV');
48 48
                 }
49 49
                 return openssl_decrypt(base64_decode($text), 'AES-256-CBC', $key, 1, $iv);
50 50
             }
51 51
             else {
52
-                logger::write("tools::crypto function used\naction is not right, its must be `encode` or `decode`",loggerTypes::WARNING);
52
+                logger::write("tools::crypto function used\naction is not right, its must be `encode` or `decode`", loggerTypes::WARNING);
53 53
                 return false;
54 54
             }
55 55
         }
56 56
         else {
57
-            logger::write("tools::crypto function used\nopenssl extension is not found , It may not be installed or enabled",loggerTypes::ERROR);
57
+            logger::write("tools::crypto function used\nopenssl extension is not found , It may not be installed or enabled", loggerTypes::ERROR);
58 58
             throw new bptException('OPENSSL_EXTENSION_MISSING');
59 59
         }
60 60
     }
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     public static function shortEncode(int $num): string {
72 72
         $codes = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
73 73
         $array = [];
74
-        while ($num > 0){
74
+        while ($num > 0) {
75 75
             $array[] = $num % 62;
76 76
             $num = floor($num / 62);
77 77
         }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         foreach ($array as &$value) {
80 80
             $value = $codes[$value];
81 81
         }
82
-        return strrev(implode('',$array));
82
+        return strrev(implode('', $array));
83 83
     }
84 84
 
85 85
     /**
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         $num = 0;
97 97
         $text = str_split(strrev($text));
98 98
         foreach ($text as $key=>$value) {
99
-            $num += strpos($codes,$value) * pow(62,$key);
99
+            $num += strpos($codes, $value) * pow(62, $key);
100 100
         }
101 101
         return $num;
102 102
     }
Please login to merge, or discard this patch.
Braces   +7 added lines, -9 removed lines patch added patch discarded remove patch
@@ -36,24 +36,20 @@  discard block
 block discarded – undo
36 36
                 $iv = self::randomString();
37 37
                 $output = base64_encode(openssl_encrypt($text, 'AES-256-CBC', $key, 1, $iv));
38 38
                 return ['hash' => $output, 'key' => $key, 'iv' => $iv];
39
-            }
40
-            elseif ($action === cryptoAction::DECRYPT) {
39
+            } elseif ($action === cryptoAction::DECRYPT) {
41 40
                 if (empty($key)) {
42 41
                     logger::write("tools::crypto function used\nkey parameter is not set",loggerTypes::ERROR);
43 42
                     throw new bptException('ARGUMENT_NOT_FOUND_KEY');
44
-                }
45
-                elseif (empty($iv)) {
43
+                } elseif (empty($iv)) {
46 44
                     logger::write("tools::crypto function used\niv parameter is not set",loggerTypes::ERROR);
47 45
                     throw new bptException('ARGUMENT_NOT_FOUND_IV');
48 46
                 }
49 47
                 return openssl_decrypt(base64_decode($text), 'AES-256-CBC', $key, 1, $iv);
50
-            }
51
-            else {
48
+            } else {
52 49
                 logger::write("tools::crypto function used\naction is not right, its must be `encode` or `decode`",loggerTypes::WARNING);
53 50
                 return false;
54 51
             }
55
-        }
56
-        else {
52
+        } else {
57 53
             logger::write("tools::crypto function used\nopenssl extension is not found , It may not be installed or enabled",loggerTypes::ERROR);
58 54
             throw new bptException('OPENSSL_EXTENSION_MISSING');
59 55
         }
@@ -75,7 +71,9 @@  discard block
 block discarded – undo
75 71
             $array[] = $num % 62;
76 72
             $num = floor($num / 62);
77 73
         }
78
-        if (count($array) < 1) $array = [0];
74
+        if (count($array) < 1) {
75
+            $array = [0];
76
+        }
79 77
         foreach ($array as &$value) {
80 78
             $value = $codes[$value];
81 79
         }
Please login to merge, or discard this patch.
src/logger.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,8 +17,7 @@  discard block
 block discarded – undo
17 17
         if (file_exists(settings::$name.'BPT.log') && !(filesize(settings::$name.'BPT.log') > self::$log_size * 1024 * 1024)) {
18 18
             $mode = 'a';
19 19
             $write = false;
20
-        }
21
-        else {
20
+        } else {
22 21
             $mode = 'w';
23 22
             $write = true;
24 23
         }
@@ -39,8 +38,7 @@  discard block
 block discarded – undo
39 38
         $text = date('Y/m/d H:i:s') . ( $type === loggerTypes::NONE ? " : $data\n\n" : " : ⤵\n$type : $data\n\n" );
40 39
         if (!is_null(self::$handler)) {
41 40
             fwrite(self::$handler, $text);
42
-        }
43
-        else {
41
+        } else {
44 42
             self::$waited_logs[] = $text;
45 43
         }
46 44
     }
Please login to merge, or discard this 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
         if (file_exists(settings::$name.'BPT.log') && !(filesize(settings::$name.'BPT.log') > self::$log_size * 1024 * 1024)) {
23 23
             $mode = 'a';
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
         self::$handler = fopen(settings::$name.'BPT.log', $mode);
31 31
 
32 32
         if ($write) {
33
-            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");
33
+            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 34
         }
35 35
 
36 36
         if (self::$waited_logs != []) {
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      * @return void
52 52
      */
53 53
     public static function write(string $data, string $type = loggerTypes::NONE): void {
54
-        $text = date('Y/m/d H:i:s') . ( $type === loggerTypes::NONE ? " : $data\n\n" : " : ⤵\n$type : $data\n\n" );
54
+        $text = date('Y/m/d H:i:s').($type === loggerTypes::NONE ? " : $data\n\n" : " : ⤵\n$type : $data\n\n");
55 55
         if (!is_null(self::$handler)) {
56 56
             fwrite(self::$handler, $text);
57 57
         }
Please login to merge, or discard this patch.