Passed
Push — main ( e0778d...2e4cb3 )
by Miaad
10:42
created
src/logger.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,8 +46,7 @@
 block discarded – undo
46 46
         $text = date('Y/m/d H:i:s') . ($type !== loggerTypes::NONE ? " : ⤵\n$type" : '') . " : $data\n\n";
47 47
         if (!is_null(self::$handler)) {
48 48
             fwrite(self::$handler, $text);
49
-        }
50
-        else {
49
+        } else {
51 50
             self::$waited_logs[] = $text;
52 51
         }
53 52
     }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,13 +17,13 @@  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 (string $bot_name, int $log_size = 10): void {
20
+    public static function init(string $bot_name, int $log_size = 10): void {
21 21
         self::$log_size = $log_size;
22 22
         $log_file = realpath($bot_name.'BPT.log');
23 23
         $mode = file_exists($log_file) && self::$log_size * 1024 * 1024 > filesize($log_file) ? 'a' : 'w';
24 24
         self::$handler = fopen($bot_name.'BPT.log', $mode);
25 25
         if ($mode === 'w') {
26
-            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
+            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");
27 27
         }
28 28
         if (self::$waited_logs != []) {
29 29
             foreach (self::$waited_logs as $log) {
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      * @return void
44 44
      */
45 45
     public static function write(string $data, string $type = loggerTypes::NONE): void {
46
-        $text = date('Y/m/d H:i:s') . ($type !== loggerTypes::NONE ? " : ⤵\n$type" : '') . " : $data\n\n";
46
+        $text = date('Y/m/d H:i:s').($type !== loggerTypes::NONE ? " : ⤵\n$type" : '')." : $data\n\n";
47 47
         if (!is_null(self::$handler)) {
48 48
             fwrite(self::$handler, $text);
49 49
         }
Please login to merge, or discard this patch.
src/types/cryptoCallback.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,18 +20,18 @@
 block discarded – undo
20 20
     public string $description;
21 21
 
22 22
     /** @var int|float Real amount or known as requested amount */
23
-    public int|float $real_amount;
23
+    public int | float $real_amount;
24 24
 
25 25
     /** @var string Fiat currency(aka usd, euro, ...) */
26 26
     public string $currency;
27 27
 
28 28
     /** @var int|float Paid amount in this payment */
29
-    public int|float $paid_amount;
29
+    public int | float $paid_amount;
30 30
 
31 31
     /** @var int|float Total paid amount for the order id */
32
-    public int|float $total_paid;
32
+    public int | float $total_paid;
33 33
 
34
-    public function __construct(stdClass|null $object = null) {
34
+    public function __construct(stdClass | null $object = null) {
35 35
         if ($object != null) {
36 36
             parent::__construct($object, self::subs);
37 37
         }
Please login to merge, or discard this patch.
src/telegram/request/curl.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -17,17 +17,17 @@  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(string $method,array $data) {
20
+    public static function init(string $method, array $data) {
21 21
         $info = self::getInfo($data);
22 22
         $data = $info['data'];
23 23
         $handler = $info['handler'];
24
-        self::setTimeout($data,$handler,$method);
24
+        self::setTimeout($data, $handler, $method);
25 25
         self::setData($data);
26 26
         $data['method'] = $method;
27 27
         curl_setopt($handler, CURLOPT_POSTFIELDS, $data);
28 28
         $result = curl_exec($handler);
29 29
         if (curl_errno($handler)) {
30
-            logger::write(curl_error($handler),loggerTypes::WARNING);
30
+            logger::write(curl_error($handler), loggerTypes::WARNING);
31 31
         }
32 32
         if ($info['token'] != settings::$token) {
33 33
             curl_close($handler);
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
             curl_setopt($curl_handler, CURLOPT_RETURNTRANSFER, true);
45 45
             curl_setopt($curl_handler, CURLOPT_SSL_VERIFYPEER, false);
46 46
         }
47
-        else{
47
+        else {
48 48
             $token = settings::$token;
49
-            if (!isset(self::$curl_handler)){
49
+            if (!isset(self::$curl_handler)) {
50 50
                 self::$curl_handler = curl_init(settings::$base_url."/bot$token/");
51 51
                 curl_setopt(self::$curl_handler, CURLOPT_RETURNTRANSFER, true);
52 52
                 curl_setopt(self::$curl_handler, CURLOPT_SSL_VERIFYPEER, false);
@@ -62,12 +62,12 @@  discard block
 block discarded – undo
62 62
         ];
63 63
     }
64 64
 
65
-    private static function setTimeout(array &$data , CurlHandle $curl_handler,string $method): void {
65
+    private static function setTimeout(array &$data, CurlHandle $curl_handler, string $method): void {
66 66
         if (isset($data['forgot'])) {
67 67
             curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, settings::$forgot_time);
68 68
             unset($data['forgot']);
69 69
         }
70
-        elseif ($method === 'getUpdates' || $method === 'setWebhook'){
70
+        elseif ($method === 'getUpdates' || $method === 'setWebhook') {
71 71
             curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, 5000);
72 72
         }
73 73
         elseif (settings::$base_timeout > 0) {
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
     }
77 77
 
78 78
     private static function setData(array &$data): void {
79
-        foreach ($data as &$value){
80
-            if (is_array($value) || (is_object($value) && !is_a($value,'CURLFile'))){
79
+        foreach ($data as &$value) {
80
+            if (is_array($value) || (is_object($value) && !is_a($value, 'CURLFile'))) {
81 81
                 $value = json_encode($value);
82 82
             }
83 83
         }
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -43,8 +43,7 @@  discard block
 block discarded – undo
43 43
             $curl_handler = curl_init(settings::$base_url."/bot$token/");
44 44
             curl_setopt($curl_handler, CURLOPT_RETURNTRANSFER, true);
45 45
             curl_setopt($curl_handler, CURLOPT_SSL_VERIFYPEER, false);
46
-        }
47
-        else{
46
+        } else{
48 47
             $token = settings::$token;
49 48
             if (!isset(self::$curl_handler)){
50 49
                 self::$curl_handler = curl_init(settings::$base_url."/bot$token/");
@@ -66,11 +65,9 @@  discard block
 block discarded – undo
66 65
         if (isset($data['forgot'])) {
67 66
             curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, settings::$forgot_time);
68 67
             unset($data['forgot']);
69
-        }
70
-        elseif ($method === 'getUpdates' || $method === 'setWebhook'){
68
+        } elseif ($method === 'getUpdates' || $method === 'setWebhook'){
71 69
             curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, 5000);
72
-        }
73
-        elseif (settings::$base_timeout > 0) {
70
+        } elseif (settings::$base_timeout > 0) {
74 71
             curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, settings::$base_timeout);
75 72
         }
76 73
     }
Please login to merge, or discard this patch.
src/database/mysql.php 2 patches
Braces   +26 added lines, -32 removed lines patch added patch discarded remove patch
@@ -89,7 +89,10 @@  discard block
 block discarded – undo
89 89
             foreach ($allowed_file_names as $allowed_file_name) {
90 90
                 if (file_exists($allowed_file_name)) {
91 91
                     $mysqli->multi_query(file_get_contents($allowed_file_name));
92
-                    while ($mysqli->next_result()){if (!$mysqli->more_results()) break;}
92
+                    while ($mysqli->next_result()){if (!$mysqli->more_results()) {
93
+                        break;
94
+                    }
95
+                    }
93 96
                     $loaded = true;
94 97
                 }
95 98
             }
@@ -107,17 +110,13 @@  discard block
 block discarded – undo
107 110
         if (self::$auto_process) {
108 111
             if (isset(BPT::$update->message)) {
109 112
                 self::processMessage(BPT::$update->message);
110
-            }
111
-            elseif (isset(BPT::$update->edited_message)) {
113
+            } elseif (isset(BPT::$update->edited_message)) {
112 114
                 self::processMessage(BPT::$update->edited_message);
113
-            }
114
-            elseif (isset(BPT::$update->callback_query)) {
115
+            } elseif (isset(BPT::$update->callback_query)) {
115 116
                 self::processCallbackQuery(BPT::$update->callback_query);
116
-            }
117
-            elseif (isset(BPT::$update->inline_query)) {
117
+            } elseif (isset(BPT::$update->inline_query)) {
118 118
                 self::processInlineQuery(BPT::$update->inline_query);
119
-            }
120
-            elseif (isset(BPT::$update->my_chat_member)) {
119
+            } elseif (isset(BPT::$update->my_chat_member)) {
121 120
                 self::processMyChatMember(BPT::$update->my_chat_member);
122 121
             }
123 122
         }
@@ -174,8 +173,7 @@  discard block
 block discarded – undo
174 173
         if ($type === chatType::PRIVATE) {
175 174
             if ($update->new_chat_member->status === chatMemberStatus::MEMBER) {
176 175
                 self::update('users', ['blocked' => false], ['id' => $update->from->id], 1);
177
-            }
178
-            else {
176
+            } else {
179 177
                 self::update('users', ['blocked' => true], ['id' => $update->from->id], 1);
180 178
             }
181 179
         }
@@ -195,8 +193,7 @@  discard block
 block discarded – undo
195 193
     public static function addDefaultWhere (array $where): bool {
196 194
         if (empty(self::$default_where)) {
197 195
             self::$default_where = $where;
198
-        }
199
-        else {
196
+        } else {
200 197
             self::$default_where = array_merge(self::$default_where, $where);
201 198
         }
202 199
         return true;
@@ -336,11 +333,9 @@  discard block
 block discarded – undo
336 333
         foreach ($vars as $var) {
337 334
             if (is_int($var)) {
338 335
                 $types .= 'i';
339
-            }
340
-            elseif (is_double($var)) {
336
+            } elseif (is_double($var)) {
341 337
                 $types .= 'd';
342
-            }
343
-            else {
338
+            } else {
344 339
                 $types .= 's';
345 340
             }
346 341
         }
@@ -368,8 +363,7 @@  discard block
 block discarded – undo
368 363
         foreach ($where as $name => $value) {
369 364
             if ($first) {
370 365
                 $first = false;
371
-            }
372
-            else {
366
+            } else {
373 367
                 $query .= ' AND';
374 368
             }
375 369
 
@@ -387,8 +381,7 @@  discard block
 block discarded – undo
387 381
             foreach ($value as $sub_value) {
388 382
                 if ($sub_first) {
389 383
                     $sub_first = false;
390
-                }
391
-                else {
384
+                } else {
392 385
                     $query .= ' AND';
393 386
                 }
394 387
                 $operator = substr($sub_value,0,2);
@@ -468,8 +461,7 @@  discard block
 block discarded – undo
468 461
         foreach ($order_by as $key => $mode) {
469 462
             if ($first) {
470 463
                 $first = false;
471
-            }
472
-            else {
464
+            } else {
473 465
                 $query .= ', ';
474 466
             }
475 467
             if (is_numeric($key)) {
@@ -483,8 +475,7 @@  discard block
 block discarded – undo
483 475
     private static function countBuilder(string &$query, int $count = null, int $offset = null): void {
484 476
         if (!empty($count)) {
485 477
             $query .= !empty($offset) ? " LIMIT $offset, $count" : " LIMIT $count";
486
-        }
487
-        elseif (!empty($offset)) {
478
+        } elseif (!empty($offset)) {
488 479
             $query .= " OFFSET $offset";
489 480
         }
490 481
     }
@@ -496,8 +487,7 @@  discard block
 block discarded – undo
496 487
         foreach ($modify as $name => $value) {
497 488
             if ($first) {
498 489
                 $first = false;
499
-            }
500
-            else {
490
+            } else {
501 491
                 $query .= ',';
502 492
             }
503 493
 
@@ -543,7 +533,9 @@  discard block
 block discarded – undo
543 533
 
544 534
     private static function insertBuilder(string &$query, string|array $columns, array|string $values): array {
545 535
         $query .= '(`' . (is_string($columns) ? $columns : implode('`, `', $columns)) . '`) VALUES (';
546
-        if (is_string($values)) $values = [$values];
536
+        if (is_string($values)) {
537
+            $values = [$values];
538
+        }
547 539
         $query .= '?' . str_repeat(', ?', count($values) - 1) . ')';
548 540
         return $values;
549 541
     }
@@ -568,8 +560,7 @@  discard block
 block discarded – undo
568 560
                     $column = 'all';
569 561
                 }
570 562
                 $query .= strtoupper($function) . "($formatted) as `{$function}_$column`";
571
-            }
572
-            else {
563
+            } else {
573 564
                 $query .= "`$column`";
574 565
             }
575 566
 
@@ -757,9 +748,12 @@  discard block
 block discarded – undo
757 748
     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 {
758 749
         $res = self::select($table, $columns, $where, $count, $offset, $group_by, $order_by, ignore_default_where: $ignore_default_where);
759 750
         if ($res) {
760
-            while ($row = $res->fetch_assoc()) yield $row;
751
+            while ($row = $res->fetch_assoc()) {
752
+                yield $row;
753
+            }
754
+        } else {
755
+            return $res;
761 756
         }
762
-        else return $res;
763 757
     }
764 758
 
765 759
     /**
Please login to merge, or discard this 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.
src/settings/easyJson.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
      *
15 15
      * @return $this
16 16
      */
17
-    public function setGlobal (array $global): self {
17
+    public function setGlobal(array $global): self {
18 18
         $this->settings['global'] = $global;
19 19
         return $this;
20 20
     }
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
      *
25 25
      * @return $this
26 26
      */
27
-    public function setGroup (array $group): self {
27
+    public function setGroup(array $group): self {
28 28
         $this->settings['group'] = $group;
29 29
         return $this;
30 30
     }
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      *
35 35
      * @return $this
36 36
      */
37
-    public function setSuperGroup (array $supergroup): self {
37
+    public function setSuperGroup(array $supergroup): self {
38 38
         $this->settings['supergroup'] = $supergroup;
39 39
         return $this;
40 40
     }
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      *
45 45
      * @return $this
46 46
      */
47
-    public function setChannel (array $channel): self {
47
+    public function setChannel(array $channel): self {
48 48
         $this->settings['channel'] = $channel;
49 49
         return $this;
50 50
     }
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      *
55 55
      * @return $this
56 56
      */
57
-    public function setUser (array $user): self {
57
+    public function setUser(array $user): self {
58 58
         $this->settings['user'] = $user;
59 59
         return $this;
60 60
     }
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      *
65 65
      * @return $this
66 66
      */
67
-    public function setGroupUser (array $group_user): self {
67
+    public function setGroupUser(array $group_user): self {
68 68
         $this->settings['group_user'] = $group_user;
69 69
         return $this;
70 70
     }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     /**
73 73
      * @return array
74 74
      */
75
-    public function getSettings (): array {
75
+    public function getSettings(): array {
76 76
         return $this->settings;
77 77
     }
78 78
 }
79 79
\ No newline at end of file
Please login to merge, or discard this patch.
src/settings/easyIdpay.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -4,17 +4,17 @@
 block discarded – undo
4 4
 class easyIdpay {
5 5
     private array $settings = [];
6 6
 
7
-    public function setApiKey (string $api_key): self {
7
+    public function setApiKey(string $api_key): self {
8 8
         $this->settings['api_key'] = $api_key;
9 9
         return $this;
10 10
     }
11 11
 
12
-    public function setSandbox (string $sandbox): self {
12
+    public function setSandbox(string $sandbox): self {
13 13
         $this->settings['sandbox'] = $sandbox;
14 14
         return $this;
15 15
     }
16 16
 
17
-    public function getSettings (): array {
17
+    public function getSettings(): array {
18 18
         return $this->settings;
19 19
     }
20 20
 }
21 21
\ No newline at end of file
Please login to merge, or discard this patch.
src/settings/easyZarinpal.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -4,22 +4,22 @@
 block discarded – undo
4 4
 class easyZarinpal {
5 5
     private array $settings = [];
6 6
 
7
-    public function setSandbox (string $sandbox): self {
7
+    public function setSandbox(string $sandbox): self {
8 8
         $this->settings['sandbox'] = $sandbox;
9 9
         return $this;
10 10
     }
11 11
 
12
-    public function setZarinGate (string $zarin_gate): self {
12
+    public function setZarinGate(string $zarin_gate): self {
13 13
         $this->settings['zarin_gate'] = $zarin_gate;
14 14
         return $this;
15 15
     }
16 16
 
17
-    public function setMerchantId (int $merchant_id): self {
17
+    public function setMerchantId(int $merchant_id): self {
18 18
         $this->settings['merchant_id'] = $merchant_id;
19 19
         return $this;
20 20
     }
21 21
 
22
-    public function getSettings (): array {
22
+    public function getSettings(): array {
23 23
         return $this->settings;
24 24
     }
25 25
 }
26 26
\ No newline at end of file
Please login to merge, or discard this patch.
src/settings/easySQL.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
      *
14 14
      * @return $this
15 15
      */
16
-    public function setHost (string $host): self {
16
+    public function setHost(string $host): self {
17 17
         $this->settings['host'] = $host;
18 18
         return $this;
19 19
     }
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      *
24 24
      * @return $this
25 25
      */
26
-    public function setPort (string $port): self {
26
+    public function setPort(string $port): self {
27 27
         $this->settings['port'] = $port;
28 28
         return $this;
29 29
     }
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      *
34 34
      * @return $this
35 35
      */
36
-    public function setUsername (string $user): self {
36
+    public function setUsername(string $user): self {
37 37
         $this->settings['user'] = $user;
38 38
         return $this;
39 39
     }
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      *
44 44
      * @return $this
45 45
      */
46
-    public function setPassword (string $pass): self {
46
+    public function setPassword(string $pass): self {
47 47
         $this->settings['pass'] = $pass;
48 48
         return $this;
49 49
     }
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      *
54 54
      * @return $this
55 55
      */
56
-    public function setDBName (string $dbname): self {
56
+    public function setDBName(string $dbname): self {
57 57
         $this->settings['dbname'] = $dbname;
58 58
         return $this;
59 59
     }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      *
64 64
      * @return $this
65 65
      */
66
-    public function setAutoProcess (bool $auto_process): self {
66
+    public function setAutoProcess(bool $auto_process): self {
67 67
         $this->settings['auto_process'] = $auto_process;
68 68
         return $this;
69 69
     }
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      *
74 74
      * @return $this
75 75
      */
76
-    public function setAutoLoad (bool $auto_load): self {
76
+    public function setAutoLoad(bool $auto_load): self {
77 77
         $this->settings['auto_load'] = $auto_load;
78 78
         return $this;
79 79
     }
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
     /**
82 82
      * @return array
83 83
      */
84
-    public function getSettings (): array {
84
+    public function getSettings(): array {
85 85
         return $this->settings;
86 86
     }
87 87
 }
88 88
\ No newline at end of file
Please login to merge, or discard this patch.
src/settings/easyCrypto.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -4,22 +4,22 @@
 block discarded – undo
4 4
 class easyCrypto {
5 5
     private array $settings = [];
6 6
 
7
-    public function setApiKey (string $api_key): self {
7
+    public function setApiKey(string $api_key): self {
8 8
         $this->settings['api_key'] = $api_key;
9 9
         return $this;
10 10
     }
11 11
 
12
-    public function setIpnSecret (string $ipn_secret): self {
12
+    public function setIpnSecret(string $ipn_secret): self {
13 13
         $this->settings['ipn_secret'] = $ipn_secret;
14 14
         return $this;
15 15
     }
16 16
 
17
-    public function setRoundDecimal (int $round_decimal): self {
17
+    public function setRoundDecimal(int $round_decimal): self {
18 18
         $this->settings['round_decimal'] = $round_decimal;
19 19
         return $this;
20 20
     }
21 21
 
22
-    public function getSettings (): array {
22
+    public function getSettings(): array {
23 23
         return $this->settings;
24 24
     }
25 25
 }
26 26
\ No newline at end of file
Please login to merge, or discard this patch.