Passed
Push — main ( cb0dfb...09414e )
by Miaad
10:52
created
src/receiver/multi.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,11 +12,9 @@
 block discarded – undo
12 12
     public static function init() {
13 13
         if (lock::exist('BPT-MULTI-EXEC')) {
14 14
             self::setUpdate(exec::init());
15
-        }
16
-        elseif(lock::exist('BPT-MULTI-CURL')) {
15
+        } elseif(lock::exist('BPT-MULTI-CURL')) {
17 16
             self::setUpdate(curl::init());
18
-        }
19
-        else {
17
+        } else {
20 18
             self::deleteOldLocks();
21 19
             self::checkURL();
22 20
             self::setCertificate();
Please login to merge, or discard this patch.
src/types/types.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -17,24 +17,20 @@  discard block
 block discarded – undo
17 17
         foreach ($object as $key=>$value) {
18 18
             if (isset($subs[$key])) {
19 19
                 $this->$key = new ($subs[$key]) ($value);
20
-            }
21
-            else {
20
+            } else {
22 21
                 if (is_array($value) && isset($subs['array'])) {
23 22
                     foreach ($value as $sub_key=>$sub_value) {
24 23
                         if (is_array($sub_value) && isset($subs['array']['array'])) {
25 24
                             foreach ($sub_value as $sub2_value) {
26 25
                                 $this->$key[$sub_key][] = new ($subs['array']['array'][$key]) ($sub2_value);
27 26
                             }
28
-                        }
29
-                        elseif(isset($subs['array'][$key])){
27
+                        } elseif(isset($subs['array'][$key])){
30 28
                             $this->$key[] = new ($subs['array'][$key]) ($sub_value);
31
-                        }
32
-                        else {
29
+                        } else {
33 30
                             $this->$key[] = $sub_value;
34 31
                         }
35 32
                     }
36
-                }
37
-                else{
33
+                } else{
38 34
                     $this->$key = $value;
39 35
                     if (ucfirst($key) === basename(get_class($this)).'_id') {
40 36
                         $this->{'id'} = $value;
@@ -51,8 +47,7 @@  discard block
 block discarded – undo
51 47
             $name = substr($name,3);
52 48
             if (isset($arguments[0])) {
53 49
                 $this->$name = $arguments[0];
54
-            }
55
-            elseif (isset($arguments['value'])) {
50
+            } elseif (isset($arguments['value'])) {
56 51
                 $this->$name = $arguments['value'];
57 52
             }
58 53
         }
Please login to merge, or discard this patch.
src/settings.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -78,11 +78,9 @@
 block discarded – undo
78 78
                     $value = 'bots_files/' . $value . '/';
79 79
                 }
80 80
                 self::$$setting = $value;
81
-            }
82
-            catch (TypeError) {
81
+            } catch (TypeError) {
83 82
                 logger::write("$setting setting has wrong type , its set to default value", loggerTypes::WARNING);
84
-            }
85
-            catch (Error) {
83
+            } catch (Error) {
86 84
                 logger::write("$setting setting is not one of library settings", loggerTypes::WARNING);
87 85
             }
88 86
         }
Please login to merge, or discard this patch.
src/database/json.php 1 patch
Braces   +43 added lines, -56 removed lines patch added patch discarded remove patch
@@ -195,17 +195,13 @@  discard block
 block discarded – undo
195 195
     public static function process (): void {
196 196
         if (isset(BPT::$update->message)) {
197 197
             self::processMessage(BPT::$update->message);
198
-        }
199
-        elseif (isset(BPT::$update->edited_message)) {
198
+        } elseif (isset(BPT::$update->edited_message)) {
200 199
             self::processMessage(BPT::$update->edited_message);
201
-        }
202
-        elseif (isset(BPT::$update->callback_query)) {
200
+        } elseif (isset(BPT::$update->callback_query)) {
203 201
             self::processCallbackQuery(BPT::$update->callback_query);
204
-        }
205
-        elseif (isset(BPT::$update->inline_query)) {
202
+        } elseif (isset(BPT::$update->inline_query)) {
206 203
             self::processInlineQuery(BPT::$update->inline_query);
207
-        }
208
-        elseif (isset(BPT::$update->chat_member)) {
204
+        } elseif (isset(BPT::$update->chat_member)) {
209 205
             self::processChatMember(BPT::$update->chat_member);
210 206
         }
211 207
     }
@@ -230,8 +226,7 @@  discard block
 block discarded – undo
230 226
             if (empty(self::$group)) {
231 227
                 $category = 'supergroups';
232 228
                 $group_id = self::$supergroup_id;
233
-            }
234
-            else {
229
+            } else {
235 230
                 $category = 'groups';
236 231
                 $group_id = self::$group_id;
237 232
             }
@@ -247,8 +242,7 @@  discard block
 block discarded – undo
247 242
             if (empty(self::$group)) {
248 243
                 $category = 'supergroups';
249 244
                 $group_id = self::$supergroup_id;
250
-            }
251
-            else {
245
+            } else {
252 246
                 $category = 'groups';
253 247
                 $group_id = self::$group_id;
254 248
             }
@@ -265,8 +259,7 @@  discard block
 block discarded – undo
265 259
                 self::$user = self::read($category . '/' . self::$user_id);
266 260
                 self::$old_user = clone self::$user;
267 261
                 self::$user->last_active = time();
268
-            }
269
-            else {
262
+            } else {
270 263
                 self::$ids[$category][] = self::$user_id;
271 264
                 self::$user = (object) self::$user_default_data;
272 265
                 self::$user->first_active = self::$user->last_active = time();
@@ -279,19 +272,16 @@  discard block
 block discarded – undo
279 272
                     }
280 273
                 }
281 274
             }
282
-        }
283
-        elseif ($type === chatType::CHANNEL) {
275
+        } elseif ($type === chatType::CHANNEL) {
284 276
             self::$channel_id = $update->chat->id;
285 277
             if (in_array(self::$channel_id,self::$ids[$category])) {
286 278
                 self::$channel = self::read($category . '/' . self::$channel_id);
287 279
                 self::$old_channel = clone self::$channel;
288
-            }
289
-            else {
280
+            } else {
290 281
                 self::$ids[$category][] = self::$channel_id;
291 282
                 self::$channel = (object) self::$channel_default_data;
292 283
             }
293
-        }
294
-        else {
284
+        } else {
295 285
             self::$user_id = $update->from->id;
296 286
             self::$group_user_id = self::$user_id;
297 287
             $chat_id = $update->chat->id;
@@ -302,22 +292,19 @@  discard block
 block discarded – undo
302 292
                     self::$old_supergroup = clone self::$supergroup;
303 293
                     self::$group_ids = self::read($category . '/' . $chat_id . '/users');
304 294
                     self::$old_group_ids = clone self::$group_ids;
305
-                }
306
-                else {
295
+                } else {
307 296
                     self::$ids[$category][] = $chat_id;
308 297
                     self::$supergroup = (object) self::$supergroup_default_data;
309 298
                     self::$group_ids = [];
310 299
                 }
311
-            }
312
-            else {
300
+            } else {
313 301
                 self::$group_id = $update->chat->id;
314 302
                 if (in_array($chat_id,self::$ids[$category])) {
315 303
                     self::$group = self::read($category . '/' . $chat_id);
316 304
                     self::$old_group = clone self::$group;
317 305
                     self::$group_ids = self::read($category . '/' . $chat_id . '/users');
318 306
                     self::$old_group_ids = clone self::$group_ids;
319
-                }
320
-                else {
307
+                } else {
321 308
                     self::$ids[$category][] = $chat_id;
322 309
                     self::$group = (object) self::$group_default_data;
323 310
                     self::$group_ids = [];
@@ -327,15 +314,16 @@  discard block
 block discarded – undo
327 314
             if (in_array(self::$user_id,self::$group_ids)) {
328 315
                 self::$group_user = self::read($category . '/' . $chat_id . '/' . self::$user_id);
329 316
                 self::$old_group_user = clone self::$group_user;
330
-            }
331
-            else {
317
+            } else {
332 318
                 self::$group_ids[] = self::$user_id;
333 319
                 self::$group_user = (object) self::$group_user_default_data;
334 320
             }
335 321
 
336 322
             self::$user = self::read($category.'/'.self::$user_id);
337 323
             self::$old_user = clone self::$user;
338
-            if (!empty(self::$user)) self::$user->last_active = time();
324
+            if (!empty(self::$user)) {
325
+                self::$user->last_active = time();
326
+            }
339 327
         }
340 328
     }
341 329
 
@@ -349,15 +337,13 @@  discard block
 block discarded – undo
349 337
                 self::$old_user = clone self::$user;
350 338
                 self::$user->last_active = time();
351 339
             }
352
-        }
353
-        elseif ($type === chatType::CHANNEL) {
340
+        } elseif ($type === chatType::CHANNEL) {
354 341
             self::$channel_id = $update->message->chat->id;
355 342
             if (in_array(self::$channel_id,self::$ids[$category])) {
356 343
                 self::$channel = self::read($category . '/' . self::$channel_id);
357 344
                 self::$old_channel = clone self::$channel;
358 345
             }
359
-        }
360
-        else {
346
+        } else {
361 347
             self::$user_id = $update->from->id;
362 348
             $chat_id = $update->message->chat->id;
363 349
             if (in_array($chat_id,self::$ids[$category])) {
@@ -365,8 +351,7 @@  discard block
 block discarded – undo
365 351
                     self::$supergroup_id = $update->message->chat->id;
366 352
                     self::$supergroup = self::read($category . '/' . $chat_id);
367 353
                     self::$old_supergroup = clone self::$supergroup;
368
-                }
369
-                else {
354
+                } else {
370 355
                     self::$group_id = $update->message->chat->id;
371 356
                     self::$group = self::read($category . '/' . $chat_id);
372 357
                     self::$old_group = clone self::$group;
@@ -383,7 +368,9 @@  discard block
 block discarded – undo
383 368
 
384 369
             self::$user = self::read($category.'/'.self::$user_id);
385 370
             self::$old_user = clone self::$user;
386
-            if (!empty(self::$user)) self::$user->last_active = time();
371
+            if (!empty(self::$user)) {
372
+                self::$user->last_active = time();
373
+            }
387 374
         }
388 375
     }
389 376
 
@@ -409,13 +396,11 @@  discard block
 block discarded – undo
409 396
             if (in_array(self::$channel_id,self::$ids[$category])) {
410 397
                 self::$channel = self::read($category . '/' . self::$channel_id);
411 398
                 self::$old_channel = clone self::$channel;
412
-            }
413
-            else {
399
+            } else {
414 400
                 self::$ids[$category][] = self::$channel_id;
415 401
                 self::$channel = (object) self::$channel_default_data;
416 402
             }
417
-        }
418
-        else {
403
+        } else {
419 404
             $chat_id = $update->chat->id;
420 405
             $by_id = $update->from->id;
421 406
             $old_user = $update->old_chat_member;
@@ -431,22 +416,19 @@  discard block
 block discarded – undo
431 416
                     self::$old_supergroup = clone self::$supergroup;
432 417
                     self::$group_ids = self::read($category . '/' . $chat_id . '/users');
433 418
                     self::$old_group_ids = clone self::$group_ids;
434
-                }
435
-                else {
419
+                } else {
436 420
                     self::$ids[$category][] = $chat_id;
437 421
                     self::$supergroup = (object) self::$supergroup_default_data;
438 422
                     self::$group_ids = [];
439 423
                 }
440
-            }
441
-            elseif ($type === chatType::GROUP) {
424
+            } elseif ($type === chatType::GROUP) {
442 425
                 self::$group_id = $chat_id;
443 426
                 if (in_array($chat_id,self::$ids[$category])) {
444 427
                     self::$group = self::read($category . '/' . $chat_id);
445 428
                     self::$old_group = clone self::$group;
446 429
                     self::$group_ids = self::read($category . '/' . $chat_id . '/users');
447 430
                     self::$old_group_ids = clone self::$group_ids;
448
-                }
449
-                else {
431
+                } else {
450 432
                     self::$ids[$category][] = $chat_id;
451 433
                     self::$group = (object) self::$group_default_data;
452 434
                     self::$group_ids = [];
@@ -456,8 +438,7 @@  discard block
 block discarded – undo
456 438
             if (!in_array($user_id,self::$group_ids)) {
457 439
                 self::$group_ids[] = $user_id;
458 440
                 self::$group_user = (object) self::$group_user_default_data;
459
-            }
460
-            else {
441
+            } else {
461 442
                 self::$group_user_id = $by_id == $user_id ? $user_id : $by_id;
462 443
                 self::$group_user = self::read($category . '/' . $chat_id . '/' . self::$group_user_id);
463 444
             }
@@ -470,8 +451,7 @@  discard block
 block discarded – undo
470 451
                         self::$group_user->removed_by = $by_id;
471 452
                     }
472 453
                 }
473
-            }
474
-            else {
454
+            } else {
475 455
                 if ($old_user->status === chatMemberStatus::LEFT || $old_user->status === chatMemberStatus::KICKED) {
476 456
                     self::$group_user->presence = true;
477 457
                     self::$group_user->removed = false;
@@ -481,8 +461,7 @@  discard block
 block discarded – undo
481 461
                         if (!empty($invite_link)) {
482 462
                             self::$group_user->accepted_by = $by_id;
483 463
                             self::$group_user->invited_by = null;
484
-                        }
485
-                        else {
464
+                        } else {
486 465
                             self::$group_user->invited_by = $by_id;
487 466
                             self::$group_user->accepted_by = null;
488 467
                         }
@@ -501,7 +480,9 @@  discard block
 block discarded – undo
501 480
      * @throws bptException
502 481
      */
503 482
     public static function deleteUser (int $user_id = null): bool {
504
-        if (empty($user_id)) $user_id = telegram::catchFields(fields::USER_ID);
483
+        if (empty($user_id)) {
484
+            $user_id = telegram::catchFields(fields::USER_ID);
485
+        }
505 486
         if (!file_exists(realpath(self::$folder . '/privates/' . $user_id . '.json'))) {
506 487
             return false;
507 488
         }
@@ -522,7 +503,9 @@  discard block
 block discarded – undo
522 503
      * @throws bptException
523 504
      */
524 505
     public static function deleteGroup (int $group_id = null): bool {
525
-        if (empty($group_id)) $group_id = telegram::catchFields(fields::CHAT_ID);
506
+        if (empty($group_id)) {
507
+            $group_id = telegram::catchFields(fields::CHAT_ID);
508
+        }
526 509
         if (!file_exists(realpath(self::$folder . '/groups/' . $group_id . '.json'))) {
527 510
             return false;
528 511
         }
@@ -544,7 +527,9 @@  discard block
 block discarded – undo
544 527
      * @throws bptException
545 528
      */
546 529
     public static function deleteSuperGroup (int $group_id = null): bool {
547
-        if (empty($group_id)) $group_id = telegram::catchFields(fields::CHAT_ID);
530
+        if (empty($group_id)) {
531
+            $group_id = telegram::catchFields(fields::CHAT_ID);
532
+        }
548 533
         if (!file_exists(realpath(self::$folder . '/supergroups/' . $group_id . '.json'))) {
549 534
             return false;
550 535
         }
@@ -566,7 +551,9 @@  discard block
 block discarded – undo
566 551
      * @throws bptException
567 552
      */
568 553
     public static function deleteChannel (int $channel_id = null): bool {
569
-        if (empty($channel_id)) $channel_id = telegram::catchFields(fields::CHAT_ID);
554
+        if (empty($channel_id)) {
555
+            $channel_id = telegram::catchFields(fields::CHAT_ID);
556
+        }
570 557
         if (!file_exists(realpath(self::$folder . '/channels/' . $channel_id . '.json'))) {
571 558
             return false;
572 559
         }
Please login to merge, or discard this patch.
src/telegram/request/answer.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,8 +49,7 @@
 block discarded – undo
49 49
         foreach ($data as $key=>&$value){
50 50
             if (!isset($value)){
51 51
                 unset($data[$key]);
52
-            }
53
-            elseif (is_array($value) || is_object($value)){
52
+            } elseif (is_array($value) || is_object($value)){
54 53
                 $value = json_encode($value);
55 54
             }
56 55
         }
Please login to merge, or discard this patch.
src/pay/idpay.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -92,11 +92,9 @@
 block discarded – undo
92 92
     public static function processCallback (): bool|int {
93 93
         if ($_SERVER['REQUEST_METHOD'] === 'POST') {
94 94
             $response = $_POST;
95
-        }
96
-        elseif ($_SERVER['REQUEST_METHOD'] === 'GET') {
95
+        } elseif ($_SERVER['REQUEST_METHOD'] === 'GET') {
97 96
             $response = $_GET;
98
-        }
99
-        else {
97
+        } else {
100 98
             return false;
101 99
         }
102 100
 
Please login to merge, or discard this patch.
src/pay/zarinpal.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,8 +43,7 @@
 block discarded – undo
43 43
     private static function getUrl (string $endpoint, bool $pay = false): string {
44 44
         if ($pay) {
45 45
             $url = self::$sandbox ? self::SANDBOX_PAY_BASE : self::PAY_BASE;
46
-        }
47
-        else {
46
+        } else {
48 47
             $url = self::$sandbox ? self::SANDBOX_API_BASE : self::API_BASE;
49 48
         }
50 49
         $url .= $endpoint;
Please login to merge, or discard this patch.
src/telegram/request.php 1 patch
Braces   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -862,20 +862,17 @@  discard block
 block discarded – undo
862 862
             foreach ($arguments['media'] as $key => $media) {
863 863
                 if ($media['media'] instanceof CURLFile) {
864 864
                     $remove_answer = true;
865
-                }
866
-                elseif (is_string($media['media']) && file_exists(realpath($media['media']))) {
865
+                } elseif (is_string($media['media']) && file_exists(realpath($media['media']))) {
867 866
                     $arguments['media'][$key]['media'] = new CURLFile($media['media']);
868 867
                     $remove_answer = true;
869 868
                 }
870 869
             }
871
-        }
872
-        elseif ($file_params = self::methodFile($name)) {
870
+        } elseif ($file_params = self::methodFile($name)) {
873 871
             foreach ($file_params as $param) {
874 872
                 if (isset($arguments[$param])) {
875 873
                     if ($arguments[$param] instanceof CURLFile) {
876 874
                         $remove_answer = true;
877
-                    }
878
-                    elseif (is_string($arguments[$param]) && file_exists(realpath($arguments[$param]))) {
875
+                    } elseif (is_string($arguments[$param]) && file_exists(realpath($arguments[$param]))) {
879 876
                         $arguments[$param] = new CURLFile($arguments[$param]);
880 877
                         $remove_answer = true;
881 878
                     }
@@ -915,8 +912,7 @@  discard block
 block discarded – undo
915 912
                 if (!isset($arguments[$default])){
916 913
                     $arguments[$default] = self::catchFields($default);
917 914
                 }
918
-            }
919
-            elseif (isset(BPT::$update->$key) || $key === 'other') {
915
+            } elseif (isset(BPT::$update->$key) || $key === 'other') {
920 916
                 foreach ($default as $def) {
921 917
                     if (!isset($arguments[$def])){
922 918
                         $arguments[$def] = self::catchFields($def);
@@ -987,9 +983,13 @@  discard block
 block discarded – undo
987 983
                     default => false
988 984
                 };
989 985
             case fields::FILE_ID :
990
-                if (isset(BPT::$update->message)) $type = 'message';
991
-                elseif (isset(BPT::$update->edited_message)) $type = 'edited_message';
992
-                else return false;
986
+                if (isset(BPT::$update->message)) {
987
+                    $type = 'message';
988
+                } elseif (isset(BPT::$update->edited_message)) {
989
+                    $type = 'edited_message';
990
+                } else {
991
+                    return false;
992
+                }
993 993
 
994 994
                 return match(true) {
995 995
                     isset(BPT::$update->$type->animation) => BPT::$update->$type->animation->file_id,
Please login to merge, or discard this patch.
src/external/jdf.php 1 patch
Braces   +38 added lines, -31 removed lines patch added patch discarded remove patch
@@ -156,12 +156,13 @@  discard block
 block discarded – undo
156 156
                     break;
157 157
                 case 'W':
158 158
                     $avs = ($date[7] == 6 ? 0 : $date[7] + 1) - $doy % 7;
159
-                    if ($avs < 0) $avs += 7;
159
+                    if ($avs < 0) {
160
+                        $avs += 7;
161
+                    }
160 162
                     $num = (int) (($doy + $avs) / 7);
161 163
                     if ($avs < 4) {
162 164
                         $num++;
163
-                    }
164
-                    elseif ($num < 1) {
165
+                    } elseif ($num < 1) {
165 166
                         $num = ($avs == 4 or $avs == ($jalali_year % 33 % 4 - 2 == (int) ($jalali_year % 33 * 0.05) ? 5 : 4)) ? 53 : 52;
166 167
                     }
167 168
                     $aks = $avs + $leap_year;
@@ -187,7 +188,9 @@  discard block
 block discarded – undo
187 188
     }
188 189
     public static function jstrftime ($format, $timestamp = '', $none = '', $time_zone = 'Asia/Tehran', $tr_num = 'fa') {
189 190
         $T_sec = 0;/* <= رفع خطاي زمان سرور ، با اعداد '+' و '-' بر حسب ثانيه */
190
-        if ($time_zone != 'local') date_default_timezone_set(($time_zone === '') ? 'Asia/Tehran' : $time_zone);
191
+        if ($time_zone != 'local') {
192
+            date_default_timezone_set(($time_zone === '') ? 'Asia/Tehran' : $time_zone);
193
+        }
191 194
         $timestamp = $T_sec + (($timestamp === '') ? time() : self::tr_num($timestamp));
192 195
         $date = explode('_', date('h_H_i_j_n_s_w_Y', $timestamp));
193 196
         [$jalali_year, $jalali_month, $jalali_day] = self::gregorian_to_jalali($date[7], $date[4], $date[3]);
@@ -199,8 +202,7 @@  discard block
 block discarded – undo
199 202
             $sub = substr($format, $i, 1);
200 203
             if ($sub == '%') {
201 204
                 $sub = substr($format, ++$i, 1);
202
-            }
203
-            else {
205
+            } else {
204 206
                 $output .= $sub;
205 207
                 continue;
206 208
             }
@@ -229,30 +231,41 @@  discard block
 block discarded – undo
229 231
                     break;
230 232
                 /* Week */ case 'U':
231 233
                 $avs = (($date[6] < 5) ? $date[6] + 2 : $date[6] - 5) - ($doy % 7);
232
-                if ($avs < 0) $avs += 7;
234
+                if ($avs < 0) {
235
+                    $avs += 7;
236
+                }
233 237
                 $num = (int) (($doy + $avs) / 7) + 1;
234
-                if ($avs > 3 or $avs == 1) $num--;
238
+                if ($avs > 3 or $avs == 1) {
239
+                    $num--;
240
+                }
235 241
                 $output .= ($num < 10) ? '0' . $num : $num;
236 242
                 break;
237 243
                 case 'V':
238 244
                     $avs = (($date[6] == 6) ? 0 : $date[6] + 1) - ($doy % 7);
239
-                    if ($avs < 0) $avs += 7;
245
+                    if ($avs < 0) {
246
+                        $avs += 7;
247
+                    }
240 248
                     $num = (int) (($doy + $avs) / 7);
241 249
                     if ($avs < 4) {
242 250
                         $num++;
243
-                    }
244
-                    elseif ($num < 1) {
251
+                    } elseif ($num < 1) {
245 252
                         $num = ($avs == 4 or $avs == ((((($jalali_year % 33) % 4) - 2) == ((int) (($jalali_year % 33) * 0.05))) ? 5 : 4)) ? 53 : 52;
246 253
                     }
247 254
                     $aks = $avs + $leap_year;
248
-                    if ($aks == 7) $aks = 0;
255
+                    if ($aks == 7) {
256
+                        $aks = 0;
257
+                    }
249 258
                     $output .= (($leap_year + 363 - $doy) < $aks and $aks < 3) ? '01' : (($num < 10) ? '0' . $num : $num);
250 259
                     break;
251 260
                 case 'W':
252 261
                     $avs = (($date[6] == 6) ? 0 : $date[6] + 1) - ($doy % 7);
253
-                    if ($avs < 0) $avs += 7;
262
+                    if ($avs < 0) {
263
+                        $avs += 7;
264
+                    }
254 265
                     $num = (int) (($doy + $avs) / 7) + 1;
255
-                    if ($avs > 3) $num--;
266
+                    if ($avs > 3) {
267
+                        $num--;
268
+                    }
256 269
                     $output .= ($num < 10) ? '0' . $num : $num;
257 270
                     break;
258 271
                 /* Month */ case 'b':
@@ -356,11 +369,12 @@  discard block
 block discarded – undo
356 369
         return ($tr_num != 'en') ? self::tr_num($output, 'fa', '.') : $output;
357 370
     }
358 371
     public static function jmktime ($hour = '', $minute = '', $second = '', $jalali_month = '', $jalali_day = '', $jalali_year = '', $none = '', $timezone = 'Asia/Tehran'): bool|int {
359
-        if ($timezone != 'local') date_default_timezone_set($timezone);
372
+        if ($timezone != 'local') {
373
+            date_default_timezone_set($timezone);
374
+        }
360 375
         if ($hour === '') {
361 376
             return time();
362
-        }
363
-        else {
377
+        } else {
364 378
             [
365 379
                 $hour,
366 380
                 $minute,
@@ -371,16 +385,13 @@  discard block
 block discarded – undo
371 385
             ] = explode('_', self::tr_num($hour . '_' . $minute . '_' . $second . '_' . $jalali_month . '_' . $jalali_day . '_' . $jalali_year));
372 386
             if ($minute === '') {
373 387
                 return mktime($hour);
374
-            }
375
-            else {
388
+            } else {
376 389
                 if ($second === '') {
377 390
                     return mktime($hour, $minute);
378
-                }
379
-                else {
391
+                } else {
380 392
                     if ($jalali_month === '') {
381 393
                         return mktime($hour, $minute, $second);
382
-                    }
383
-                    else {
394
+                    } else {
384 395
                         $jdate = explode('_', self::jdate('Y_j', '', '', $timezone, 'en'));
385 396
                         if ($jalali_day === '') {
386 397
                             [
@@ -389,8 +400,7 @@  discard block
 block discarded – undo
389 400
                                 $gregorian_day
390 401
                             ] = self::jalali_to_gregorian($jdate[0], $jalali_month, $jdate[1]);
391 402
                             return mktime($hour, $minute, $second, $gregorian_month);
392
-                        }
393
-                        else {
403
+                        } else {
394 404
                             if ($jalali_year === '') {
395 405
                                 [
396 406
                                     $gregorian_year,
@@ -398,8 +408,7 @@  discard block
 block discarded – undo
398 408
                                     $gregorian_day
399 409
                                 ] = self::jalali_to_gregorian($jdate[0], $jalali_month, $jalali_day);
400 410
                                 return mktime($hour, $minute, $second, $gregorian_month, $gregorian_day);
401
-                            }
402
-                            else {
411
+                            } else {
403 412
                                 [
404 413
                                     $gregorian_year,
405 414
                                     $gregorian_month,
@@ -463,8 +472,7 @@  discard block
 block discarded – undo
463 472
                             'نوزده'
464 473
                         ];
465 474
                         $h34 = $k34[substr($num, 2 - $length, 2) - 10];
466
-                    }
467
-                    else {
475
+                    } else {
468 476
                         $xy4 = substr($num, 3 - $length, 1);
469 477
                         $p34 = ($xy3 == 0 or $xy4 == 0) ? '' : ' و ';
470 478
                         $k3 = ['', '', 'بیست', 'سی', 'چهل', 'پنجاه', 'شصت', 'هفتاد', 'هشتاد', 'نود'];
@@ -610,8 +618,7 @@  discard block
 block discarded – undo
610 618
         if ($days < 186) {
611 619
             $jalali_month = 1 + (int) ($days / 31);
612 620
             $jalali_day = 1 + ($days % 31);
613
-        }
614
-        else {
621
+        } else {
615 622
             $jalali_month = 7 + (int) (($days - 186) / 30);
616 623
             $jalali_day = 1 + (($days - 186) % 30);
617 624
         }
Please login to merge, or discard this patch.