Passed
Branch main (405ee4)
by Miaad
02:11
created
settings.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 
22 22
     public static int $log_size = 10;
23 23
 
24
-    public static string|CURLFile|null $certificate = null;
24
+    public static string | CURLFile | null $certificate = null;
25 25
 
26 26
     public static bool $handler = true;
27 27
 
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
 
46 46
     public static array $allowed_updates = ['message', 'edited_channel_post', 'callback_query', 'inline_query'];
47 47
 
48
-    public static array|mysqli|null $db = ['type' => 'json', 'file_name' => 'BPT-DB.json'];
48
+    public static array | mysqli | null $db = ['type' => 'json', 'file_name' => 'BPT-DB.json'];
49 49
 
50 50
 
51
-    public static function init (array|stdClass $settings) {
51
+    public static function init(array | stdClass $settings) {
52 52
         $settings = (array) $settings;
53 53
 
54 54
         if (!(isset($settings['logger']) && $settings['logger'] == false)) {
@@ -56,14 +56,14 @@  discard block
 block discarded – undo
56 56
         }
57 57
 
58 58
         foreach ($settings as $setting => $value) {
59
-            try{
59
+            try {
60 60
                 self::$$setting = $value;
61 61
             }
62
-            catch (TypeError){
63
-                logger::write("$setting setting has wrong type , its set to default value",loggerTypes::WARNING);
62
+            catch (TypeError) {
63
+                logger::write("$setting setting has wrong type , its set to default value", loggerTypes::WARNING);
64 64
             }
65
-            catch (Error){
66
-                logger::write("$setting setting is not one of library settings",loggerTypes::WARNING);
65
+            catch (Error) {
66
+                logger::write("$setting setting is not one of library settings", loggerTypes::WARNING);
67 67
             }
68 68
         }
69 69
 
@@ -77,19 +77,19 @@  discard block
 block discarded – undo
77 77
                 }
78 78
             }
79 79
             else {
80
-                logger::write('token format is not right, check it and try again',loggerTypes::ERROR);
80
+                logger::write('token format is not right, check it and try again', loggerTypes::ERROR);
81 81
                 throw new bptException('TOKEN_NOT_TRUE');
82 82
             }
83 83
         }
84 84
         else {
85
-            logger::write('You must specify token parameter in settings',loggerTypes::ERROR);
85
+            logger::write('You must specify token parameter in settings', loggerTypes::ERROR);
86 86
             throw new bptException('TOKEN_NOT_FOUND');
87 87
         }
88 88
     }
89 89
 
90 90
     public static function done() {
91 91
         if (self::$logger) {
92
-            $estimated = round((microtime(true)-$_SERVER['REQUEST_TIME_FLOAT'])*1000,2);
92
+            $estimated = round((microtime(true) - $_SERVER['REQUEST_TIME_FLOAT']) * 1000, 2);
93 93
             $status_message = match (true) {
94 94
                 $estimated < 100 => 'Excellent',
95 95
                 $estimated < 500 => 'Very good',
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         if (self::$secure_folder) {
122 122
             $address = explode('/', $_SERVER['REQUEST_URI']);
123 123
             unset($address[count($address) - 1]);
124
-            $address = implode('/', $address) . '/BPT.php';
124
+            $address = implode('/', $address).'/BPT.php';
125 125
             $text = "ErrorDocument 404 $address\nErrorDocument 403 $address\n Options -Indexes\n  Order Deny,Allow\nDeny from all\nAllow from 127.0.0.1\n<Files *.php>\n    Order Allow,Deny\n    Allow from all\n</Files>";
126 126
             if (!file_exists('.htaccess') || filesize('.htaccess') != strlen($text)) {
127 127
                 file_put_contents('.htaccess', $text);
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
             getUpdates::init();
141 141
         }
142 142
         else {
143
-            logger::write('You can\'t use getUpdates receiver when handler is off , use webhook or use handler',loggerTypes::ERROR);
143
+            logger::write('You can\'t use getUpdates receiver when handler is off , use webhook or use handler', loggerTypes::ERROR);
144 144
             throw new bptException('GETUPDATE_NEED_HANDLER');
145 145
         }
146 146
     }
Please login to merge, or discard this patch.
tools/generator.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
      *
29 29
      * @return string
30 30
      */
31
-    public static function randomString (int $length = 16, string $characters = 'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ'): string {
31
+    public static function randomString(int $length = 16, string $characters = 'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ'): string {
32 32
         $rand_string = '';
33 33
         $char_len = strlen($characters) - 1;
34
-        for ($i = 0; $i < $length; $i ++) {
34
+        for ($i = 0; $i < $length; $i++) {
35 35
             $rand_string .= $characters[rand(0, $char_len)];
36 36
         }
37 37
         return $rand_string;
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
      * @return inlineKeyboardMarkup|replyKeyboardMarkup replyKeyboardMarkup for keyboard and inlineKeyboardMarkup for inline
61 61
      * @throws bptException
62 62
      */
63
-    public static function easyKey(array $keyboard = [], array $inline = []): inlineKeyboardMarkup|replyKeyboardMarkup {
63
+    public static function easyKey(array $keyboard = [], array $inline = []): inlineKeyboardMarkup | replyKeyboardMarkup {
64 64
         if (!empty($keyboard)) {
65 65
             $keyboard_object = new replyKeyboardMarkup();
66 66
             $keyboard_object->setResize_keyboard($keyboard['resize'] ?? true);
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
             return $keyboard_object;
120 120
         }
121 121
         else {
122
-            logger::write("tools::eKey function used\nkeyboard or inline parameter must be set",loggerTypes::ERROR);
122
+            logger::write("tools::eKey function used\nkeyboard or inline parameter must be set", loggerTypes::ERROR);
123 123
             throw new bptException('ARGUMENT_NOT_FOUND_KEYBOARD_INLINE');
124 124
         }
125 125
     }
Please login to merge, or discard this patch.