Passed
Push — main ( b0527a...6fd7ec )
by Miaad
01:30
created
settings.php 2 patches
Spacing   +12 added lines, -12 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
 
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
 
52 52
     public static array $allowed_updates = ['message', 'edited_channel_post', 'callback_query', 'inline_query'];
53 53
 
54
-    public static array|mysqli|null $db = ['type' => 'json', 'file_name' => 'BPT-DB.json'];
54
+    public static array | mysqli | null $db = ['type' => 'json', 'file_name' => 'BPT-DB.json'];
55 55
 
56 56
 
57
-    public static function init (array|stdClass $settings) {
57
+    public static function init(array | stdClass $settings) {
58 58
         $settings = (array) $settings;
59 59
 
60 60
         if (!(isset($settings['logger']) && $settings['logger'] == false)) {
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
         }
63 63
 
64 64
         foreach ($settings as $setting => $value) {
65
-            try{
65
+            try {
66 66
                 self::$$setting = $value;
67 67
             }
68
-            catch (TypeError){
69
-                logger::write("$setting setting has wrong type , its set to default value",'warning');
68
+            catch (TypeError) {
69
+                logger::write("$setting setting has wrong type , its set to default value", 'warning');
70 70
             }
71
-            catch (Error){
72
-                logger::write("$setting setting is not one of library settings",'warning');
71
+            catch (Error) {
72
+                logger::write("$setting setting is not one of library settings", 'warning');
73 73
             }
74 74
         }
75 75
 
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
                 self::$receiver !== receiver::GETUPDATES ? self::webhook() : self::getUpdates();
82 82
             }
83 83
             else {
84
-                logger::write('token format is not right, check it and try again','error');
84
+                logger::write('token format is not right, check it and try again', 'error');
85 85
             }
86 86
         }
87 87
         else {
88
-            logger::write('You must specify token parameter in settings','error');
88
+            logger::write('You must specify token parameter in settings', 'error');
89 89
         }
90 90
     }
91 91
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         if (self::$secure_folder) {
109 109
             $address = explode('/', $_SERVER['REQUEST_URI']);
110 110
             unset($address[count($address) - 1]);
111
-            $address = implode('/', $address) . '/BPT.php';
111
+            $address = implode('/', $address).'/BPT.php';
112 112
             $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>";
113 113
             if (!file_exists('.htaccess') || filesize('.htaccess') != strlen($text)) {
114 114
                 file_put_contents('.htaccess', $text);
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
             getUpdates::init();
128 128
         }
129 129
         else {
130
-            logger::write('You can\'t use getUpdates receiver when handler is off , use webhook or use handler','error');
130
+            logger::write('You can\'t use getUpdates receiver when handler is off , use webhook or use handler', 'error');
131 131
         }
132 132
     }
133 133
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -64,11 +64,9 @@  discard block
 block discarded – undo
64 64
         foreach ($settings as $setting => $value) {
65 65
             try{
66 66
                 self::$$setting = $value;
67
-            }
68
-            catch (TypeError){
67
+            } catch (TypeError){
69 68
                 logger::write("$setting setting has wrong type , its set to default value",'warning');
70
-            }
71
-            catch (Error){
69
+            } catch (Error){
72 70
                 logger::write("$setting setting is not one of library settings",'warning');
73 71
             }
74 72
         }
@@ -79,12 +77,10 @@  discard block
 block discarded – undo
79 77
                 self::secureFolder();
80 78
                 self::db();
81 79
                 self::$receiver !== receiver::GETUPDATES ? self::webhook() : self::getUpdates();
82
-            }
83
-            else {
80
+            } else {
84 81
                 logger::write('token format is not right, check it and try again','error');
85 82
             }
86
-        }
87
-        else {
83
+        } else {
88 84
             logger::write('You must specify token parameter in settings','error');
89 85
         }
90 86
     }
@@ -125,8 +121,7 @@  discard block
 block discarded – undo
125 121
     private static function getUpdates() {
126 122
         if (self::$handler) {
127 123
             getUpdates::init();
128
-        }
129
-        else {
124
+        } else {
130 125
             logger::write('You can\'t use getUpdates receiver when handler is off , use webhook or use handler','error');
131 126
         }
132 127
     }
Please login to merge, or discard this patch.
receiver/getUpdates.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 namespace BPT\receiver;
4 4
 
5 5
 class getUpdates {
6
-    public static function init () {
6
+    public static function init() {
7 7
 
8 8
     }
9 9
 }
10 10
\ No newline at end of file
Please login to merge, or discard this patch.
db/db.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 mysqli;
6 6
 
7 7
 class db {
8
-    public static function init (array|mysqli $db) {
8
+    public static function init(array | mysqli $db) {
9 9
 
10 10
     }
11 11
 }
12 12
\ No newline at end of file
Please login to merge, or discard this patch.
api/request.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -225,18 +225,18 @@  discard block
 block discarded – undo
225 225
     ];
226 226
 
227 227
 
228
-    public static function __callStatic (string $name, array $arguments) {
228
+    public static function __callStatic(string $name, array $arguments) {
229 229
         if ($action = self::methodAction($name)) {
230
-            self::keysName($action,$arguments);
231
-            self::readyFile($action,$arguments);
230
+            self::keysName($action, $arguments);
231
+            self::readyFile($action, $arguments);
232 232
             print_r($arguments);
233 233
         }
234 234
         else {
235
-            logger::write("$name method is not supported",'error');
235
+            logger::write("$name method is not supported", 'error');
236 236
         }
237 237
     }
238 238
 
239
-    private static function keysName (string $name, array &$arguments) {
239
+    private static function keysName(string $name, array &$arguments) {
240 240
         foreach ($arguments as $key => $argument) {
241 241
             if (is_numeric($key) && isset(self::METHODS_KEYS[$name][$key])) {
242 242
                 $arguments[self::METHODS_KEYS[$name][$key]] = $argument;
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
         }
246 246
     }
247 247
 
248
-    private static function methodAction(string $name): string|false {
248
+    private static function methodAction(string $name): string | false {
249 249
         return self::METHODS_ACTION[strtolower($name)] ?? false;
250 250
     }
251 251
 
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
         }
267 267
     }
268 268
 
269
-    private static function methodFile(string $name): array|false {
269
+    private static function methodFile(string $name): array | false {
270 270
         return self::METHODS_WITH_FILE[$name] ?? false;
271 271
     }
272 272
 }
273 273
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -230,8 +230,7 @@  discard block
 block discarded – undo
230 230
             self::keysName($action,$arguments);
231 231
             self::readyFile($action,$arguments);
232 232
             print_r($arguments);
233
-        }
234
-        else {
233
+        } else {
235 234
             logger::write("$name method is not supported",'error');
236 235
         }
237 236
     }
@@ -256,8 +255,7 @@  discard block
 block discarded – undo
256 255
                     $arguments['media'][$key]['media'] = new CURLFile($media['media']);
257 256
                 }
258 257
             }
259
-        }
260
-        elseif ($file_params = self::methodFile($name)) {
258
+        } elseif ($file_params = self::methodFile($name)) {
261 259
             foreach ($file_params as $param) {
262 260
                 if (isset($arguments[$param]) && file_exists($arguments[$param])) {
263 261
                     $arguments[$param] = new CURLFile($arguments[$param]);
Please login to merge, or discard this patch.
logger.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
     private static $handler;
9 9
 
10 10
 
11
-    public static function init (int $log_size = 10) {
11
+    public static function init(int $log_size = 10) {
12 12
         self::$log_size = $log_size;
13 13
         if (file_exists('BPT.log') && !(filesize('BPT.log') > self::$log_size * 1024 * 1024)) {
14 14
             $mode = 'a';
@@ -22,13 +22,13 @@  discard block
 block discarded – undo
22 22
         self::$handler = fopen('BPT.log', $mode);
23 23
 
24 24
         if ($write) {
25
-            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");
25
+            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");
26 26
         }
27 27
     }
28 28
 
29 29
     public static function write($data, $type = '') {
30 30
         if (!is_null(self::$handler)) {
31
-            $text = date('Y/m/d H:i:s') . ( $type === '' ? " : $data\n\n" : " : ⤵\n$type : $data\n\n" );
31
+            $text = date('Y/m/d H:i:s').($type === '' ? " : $data\n\n" : " : ⤵\n$type : $data\n\n");
32 32
             fwrite(self::$handler, $text);
33 33
         }
34 34
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,7 @@
 block discarded – undo
13 13
         if (file_exists('BPT.log') && !(filesize('BPT.log') > self::$log_size * 1024 * 1024)) {
14 14
             $mode = 'a';
15 15
             $write = false;
16
-        }
17
-        else {
16
+        } else {
18 17
             $mode = 'w';
19 18
             $write = true;
20 19
         }
Please login to merge, or discard this patch.
BPT.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,8 +17,7 @@
 block discarded – undo
17 17
     public function __call (string $name, array $arguments) {
18 18
         if (!isset($arguments[1]) && is_array($arguments[0])) {
19 19
             request::$name(...$arguments[0]);
20
-        }
21
-        else {
20
+        } else {
22 21
             request::$name($arguments);
23 22
         }
24 23
     }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -217,18 +217,18 @@  discard block
 block discarded – undo
217 217
  * @method getGameHighScores (int|null $user_id = null, int|null $chat_id = null, int|null $message_id = null, string|null $inline_message_id = null, string|null $token = null, bool|null $return_array = null, bool|null $forgot = null, bool|null $answer = null) Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. On success, returns an Array of GameHighScore objects.
218 218
  * @method getGameHigh (int|null $user_id = null, int|null $chat_id = null, int|null $message_id = null, string|null $inline_message_id = null, string|null $token = null, bool|null $return_array = null, bool|null $forgot = null, bool|null $answer = null) Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. On success, returns an Array of GameHighScore objects.
219 219
  */
220
-class BPT{
220
+class BPT {
221 221
     public static update $update;
222 222
 
223 223
     public static BPT $handler;
224 224
 
225 225
 
226
-    public function __construct (array|stdClass $settings) {
226
+    public function __construct(array | stdClass $settings) {
227 227
         settings::init($settings);
228 228
         static::$handler = &$this;
229 229
     }
230 230
 
231
-    public function __call (string $name, array $arguments) {
231
+    public function __call(string $name, array $arguments) {
232 232
         if (!isset($arguments[1]) && is_array($arguments[0])) {
233 233
             request::$name(...$arguments[0]);
234 234
         }
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
         }
238 238
     }
239 239
 
240
-    public static function close () {
240
+    public static function close() {
241 241
         die("<div style='width:98vw;height:98vh;display:flex;justify-content:center;align-items:center;font-size:25vw'>BPT</div>");
242 242
     }
243 243
 }
Please login to merge, or discard this patch.
types/inlineQueryResultVideo.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -10,62 +10,62 @@
 block discarded – undo
10 10
  * message with the specified content instead of the video.
11 11
  */
12 12
 class inlineQueryResultVideo extends types {
13
-	/** Keep all of properties which has sub properties */
14
-	private const subs = [
15
-		'reply_markup' => 'BPT\types\inlineKeyboardMarkup',
16
-		'input_message_content' => 'BPT\types\inputMessageContent',
17
-	];
13
+    /** Keep all of properties which has sub properties */
14
+    private const subs = [
15
+        'reply_markup' => 'BPT\types\inlineKeyboardMarkup',
16
+        'input_message_content' => 'BPT\types\inputMessageContent',
17
+    ];
18 18
 
19
-	/** Type of the result, must be video */
20
-	public string $type;
19
+    /** Type of the result, must be video */
20
+    public string $type;
21 21
 
22
-	/** Unique identifier for this result, 1-64 bytes */
23
-	public string $id;
22
+    /** Unique identifier for this result, 1-64 bytes */
23
+    public string $id;
24 24
 
25
-	/** A valid URL for the embedded video player or video file */
26
-	public string $video_url;
25
+    /** A valid URL for the embedded video player or video file */
26
+    public string $video_url;
27 27
 
28
-	/** Mime type of the content of video url, “text/html” or “video/mp4” */
29
-	public string $mime_type;
28
+    /** Mime type of the content of video url, “text/html” or “video/mp4” */
29
+    public string $mime_type;
30 30
 
31
-	/** URL of the thumbnail (JPEG only) for the video */
32
-	public string $thumb_url;
31
+    /** URL of the thumbnail (JPEG only) for the video */
32
+    public string $thumb_url;
33 33
 
34
-	/** Title for the result */
35
-	public string $title;
34
+    /** Title for the result */
35
+    public string $title;
36 36
 
37
-	/** Optional. Caption of the video to be sent, 0-1024 characters after entities parsing */
38
-	public string $caption;
37
+    /** Optional. Caption of the video to be sent, 0-1024 characters after entities parsing */
38
+    public string $caption;
39 39
 
40
-	/** Optional. Mode for parsing entities in the video caption. See formatting options for more details. */
41
-	public string $parse_mode;
40
+    /** Optional. Mode for parsing entities in the video caption. See formatting options for more details. */
41
+    public string $parse_mode;
42 42
 
43
-	/** Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode */
44
-	public array $caption_entities;
43
+    /** Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode */
44
+    public array $caption_entities;
45 45
 
46
-	/** Optional. Video width */
47
-	public int $video_width;
46
+    /** Optional. Video width */
47
+    public int $video_width;
48 48
 
49
-	/** Optional. Video height */
50
-	public int $video_height;
49
+    /** Optional. Video height */
50
+    public int $video_height;
51 51
 
52
-	/** Optional. Video duration in seconds */
53
-	public int $video_duration;
52
+    /** Optional. Video duration in seconds */
53
+    public int $video_duration;
54 54
 
55
-	/** Optional. Short description of the result */
56
-	public string $description;
55
+    /** Optional. Short description of the result */
56
+    public string $description;
57 57
 
58
-	/** Optional. Inline keyboard attached to the message */
59
-	public inlineKeyboardMarkup $reply_markup;
58
+    /** Optional. Inline keyboard attached to the message */
59
+    public inlineKeyboardMarkup $reply_markup;
60 60
 
61
-	/**
62
-	 * Optional. Content of the message to be sent instead of the video. This field is required if
63
-	 * InlineQueryResultVideo is used to send an HTML-page as a result (e.g., a YouTube video).
64
-	 */
65
-	public inputMessageContent $input_message_content;
61
+    /**
62
+     * Optional. Content of the message to be sent instead of the video. This field is required if
63
+     * InlineQueryResultVideo is used to send an HTML-page as a result (e.g., a YouTube video).
64
+     */
65
+    public inputMessageContent $input_message_content;
66 66
 
67 67
 
68
-	public function __construct(stdClass $update) {
69
-		parent::__construct($update, self::subs);
70
-	}
68
+    public function __construct(stdClass $update) {
69
+        parent::__construct($update, self::subs);
70
+    }
71 71
 }
Please login to merge, or discard this patch.
types/keyboardButtonPollType.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -9,17 +9,17 @@
 block discarded – undo
9 9
  * is pressed.
10 10
  */
11 11
 class keyboardButtonPollType extends types {
12
-	/** Keep all of properties which has sub properties */
13
-	private const subs = [];
12
+    /** Keep all of properties which has sub properties */
13
+    private const subs = [];
14 14
 
15
-	/**
16
-	 * Optional. If quiz is passed, the user will be allowed to create only polls in the quiz mode. If regular is
17
-	 * passed, only regular polls will be allowed. Otherwise, the user will be allowed to create a poll of any type.
18
-	 */
19
-	public string $type;
15
+    /**
16
+     * Optional. If quiz is passed, the user will be allowed to create only polls in the quiz mode. If regular is
17
+     * passed, only regular polls will be allowed. Otherwise, the user will be allowed to create a poll of any type.
18
+     */
19
+    public string $type;
20 20
 
21 21
 
22
-	public function __construct(stdClass $update) {
23
-		parent::__construct($update, self::subs);
24
-	}
22
+    public function __construct(stdClass $update) {
23
+        parent::__construct($update, self::subs);
24
+    }
25 25
 }
Please login to merge, or discard this patch.
types/inlineQueryResultPhoto.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -10,53 +10,53 @@
 block discarded – undo
10 10
  * photo.
11 11
  */
12 12
 class inlineQueryResultPhoto extends types {
13
-	/** Keep all of properties which has sub properties */
14
-	private const subs = [
15
-		'reply_markup' => 'BPT\types\inlineKeyboardMarkup',
16
-		'input_message_content' => 'BPT\types\inputMessageContent',
17
-	];
13
+    /** Keep all of properties which has sub properties */
14
+    private const subs = [
15
+        'reply_markup' => 'BPT\types\inlineKeyboardMarkup',
16
+        'input_message_content' => 'BPT\types\inputMessageContent',
17
+    ];
18 18
 
19
-	/** Type of the result, must be photo */
20
-	public string $type;
19
+    /** Type of the result, must be photo */
20
+    public string $type;
21 21
 
22
-	/** Unique identifier for this result, 1-64 bytes */
23
-	public string $id;
22
+    /** Unique identifier for this result, 1-64 bytes */
23
+    public string $id;
24 24
 
25
-	/** A valid URL of the photo. Photo must be in JPEG format. Photo size must not exceed 5MB */
26
-	public string $photo_url;
25
+    /** A valid URL of the photo. Photo must be in JPEG format. Photo size must not exceed 5MB */
26
+    public string $photo_url;
27 27
 
28
-	/** URL of the thumbnail for the photo */
29
-	public string $thumb_url;
28
+    /** URL of the thumbnail for the photo */
29
+    public string $thumb_url;
30 30
 
31
-	/** Optional. Width of the photo */
32
-	public int $photo_width;
31
+    /** Optional. Width of the photo */
32
+    public int $photo_width;
33 33
 
34
-	/** Optional. Height of the photo */
35
-	public int $photo_height;
34
+    /** Optional. Height of the photo */
35
+    public int $photo_height;
36 36
 
37
-	/** Optional. Title for the result */
38
-	public string $title;
37
+    /** Optional. Title for the result */
38
+    public string $title;
39 39
 
40
-	/** Optional. Short description of the result */
41
-	public string $description;
40
+    /** Optional. Short description of the result */
41
+    public string $description;
42 42
 
43
-	/** Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing */
44
-	public string $caption;
43
+    /** Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing */
44
+    public string $caption;
45 45
 
46
-	/** Optional. Mode for parsing entities in the photo caption. See formatting options for more details. */
47
-	public string $parse_mode;
46
+    /** Optional. Mode for parsing entities in the photo caption. See formatting options for more details. */
47
+    public string $parse_mode;
48 48
 
49
-	/** Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode */
50
-	public array $caption_entities;
49
+    /** Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode */
50
+    public array $caption_entities;
51 51
 
52
-	/** Optional. Inline keyboard attached to the message */
53
-	public inlineKeyboardMarkup $reply_markup;
52
+    /** Optional. Inline keyboard attached to the message */
53
+    public inlineKeyboardMarkup $reply_markup;
54 54
 
55
-	/** Optional. Content of the message to be sent instead of the photo */
56
-	public inputMessageContent $input_message_content;
55
+    /** Optional. Content of the message to be sent instead of the photo */
56
+    public inputMessageContent $input_message_content;
57 57
 
58 58
 
59
-	public function __construct(stdClass $update) {
60
-		parent::__construct($update, self::subs);
61
-	}
59
+    public function __construct(stdClass $update) {
60
+        parent::__construct($update, self::subs);
61
+    }
62 62
 }
Please login to merge, or discard this patch.