Passed
Push — main ( 1e0eff...d761d2 )
by Miaad
01:42
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/receiver/getUpdates.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@  discard block
 block discarded – undo
22 22
                     self::handleUpdates($updates);
23 23
                     lock::save('getUpdate',BPT::$update->update_id+1);
24 24
                     $last_update_id = BPT::$update->update_id+1;
25
-                }
26
-                else {
25
+                } else {
27 26
                     logger::write("There is some problem happened , telegram response : \n".json_encode($updates),loggerTypes::ERROR);
28 27
                     BPT::exit(print_r($updates,true));
29 28
                 }
@@ -34,8 +33,7 @@  discard block
 block discarded – undo
34 33
     private static function loadData(): bool|int|string {
35 34
         if (lock::exist('getUpdate')) {
36 35
             $last_update_id = lock::read('getUpdate');
37
-        }
38
-        else {
36
+        } else {
39 37
             self::deleteOldLocks();
40 38
             telegram::deleteWebhook();
41 39
             $last_update_id = 0;
Please login to merge, or discard this patch.
src/api/request/answer.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,8 +34,7 @@  discard block
 block discarded – undo
34 34
         if(settings::$receiver === receiver::GETUPDATES) {
35 35
             logger::write('Answer mode only work when receiver is webhook',loggerTypes::ERROR);
36 36
             throw new bptException('ANSWER_MODE_GETUPDATES');
37
-        }
38
-        elseif(settings::$multi) {
37
+        } elseif(settings::$multi) {
39 38
             logger::write('You can not use answer mode when multi setting is on',loggerTypes::ERROR);
40 39
             throw new bptException('ANSWER_MODE_MULTI');
41 40
         }
@@ -49,8 +48,7 @@  discard block
 block discarded – undo
49 48
         foreach ($data as $key=>&$value){
50 49
             if (!isset($value)){
51 50
                 unset($data[$key]);
52
-            }
53
-            elseif (is_array($value) || is_object($value)){
51
+            } elseif (is_array($value) || is_object($value)){
54 52
                 $value = json_encode($value);
55 53
             }
56 54
         }
Please login to merge, or discard this patch.
src/api/telegram.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,7 @@
 block discarded – undo
6 6
     public function __call (string $name, array $arguments) {
7 7
         if (!isset($arguments[1]) && isset($arguments[0]) && is_array($arguments[0])) {
8 8
             return request::$name(...$arguments[0]);
9
-        }
10
-        else {
9
+        } else {
11 10
             return request::$name(...$arguments);
12 11
         }
13 12
     }
Please login to merge, or discard this patch.
src/tools/is.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -175,8 +175,9 @@
 block discarded – undo
175 175
             if (telegram::$status) {
176 176
                 $check = $check->status;
177 177
                 $result[$id] = $check !== chatMemberStatus::LEFT && $check !== chatMemberStatus::KICKED;
178
+            } else {
179
+                $result[$id] = null;
178 180
             }
179
-            else $result[$id] = null;
180 181
         }
181 182
         return $result;
182 183
     }
Please login to merge, or discard this patch.
src/tools/file.php 1 patch
Braces   +10 added lines, -11 removed lines patch added patch discarded remove patch
@@ -35,14 +35,14 @@  discard block
 block discarded – undo
35 35
             curl_exec($ch);
36 36
             $size = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD);
37 37
             curl_close($ch);
38
-        }
39
-        else {
38
+        } else {
40 39
             $size = file_exists($path) ? filesize($path) : false;
41 40
         }
42 41
         if (isset($size) && is_numeric($size)) {
43 42
             return $format ? tools::byteFormat($size) : $size;
43
+        } else {
44
+            return false;
44 45
         }
45
-        else return false;
46 46
     }
47 47
 
48 48
     /**
@@ -68,15 +68,16 @@  discard block
 block discarded – undo
68 68
                         $file->isDir() ? rmdir($file->getRealPath()) : unlink($file->getRealPath());
69 69
                     }
70 70
                     return rmdir($path);
71
-                }
72
-                else {
71
+                } else {
73 72
                     logger::write("tools::delete function used\ndelete function cannot delete folder because its have subFiles and sub parameter haven't true value",loggerTypes::ERROR);
74 73
                     throw new bptException('DELETE_FOLDER_HAS_SUB');
75 74
                 }
75
+            } else {
76
+                return rmdir($path);
76 77
             }
77
-            else return rmdir($path);
78
+        } else {
79
+            return unlink($path);
78 80
         }
79
-        else return unlink($path);
80 81
     }
81 82
 
82 83
     /**
@@ -104,13 +105,11 @@  discard block
 block discarded – undo
104 105
                         $zip->addFile($filePath, substr($filePath, $root_len));
105 106
                     }
106 107
                 }
107
-            }
108
-            else {
108
+            } else {
109 109
                 $zip->addFile($path, basename($path));
110 110
             }
111 111
             return $zip->close();
112
-        }
113
-        else {
112
+        } else {
114 113
             logger::write("tools::zip function used\nzip extension is not found , It may not be installed or enabled", loggerTypes::ERROR);
115 114
             throw new bptException('ZIP_EXTENSION_MISSING');
116 115
         }
Please login to merge, or discard this patch.
src/tools/convert.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -105,8 +105,9 @@
 block discarded – undo
105 105
         foreach ($string as $k => &$v) {
106 106
             if ($diff->$v) {
107 107
                 $v = $diff->$v;
108
+            } else {
109
+                unset($string[$k]);
108 110
             }
109
-            else unset($string[$k]);
110 111
         }
111 112
         $string['status'] = $base_time < $target_time ? 'later' : 'ago';
112 113
 
Please login to merge, or discard this patch.
src/types/types.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -17,21 +17,18 @@  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)) {
23 22
                     foreach ($value as $sub_key=>$sub_value) {
24 23
                         if (is_array($sub_value)) {
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
-                        else{
27
+                        } else{
30 28
                             $this->$key[] = new ($subs['array'][$key]) ($sub_value);
31 29
                         }
32 30
                     }
33
-                }
34
-                else{
31
+                } else{
35 32
                     $this->$key = $value;
36 33
                     if (ucfirst($key) === basename(get_class($this)).'_id') {
37 34
                         $this->{'id'} = $value;
@@ -48,8 +45,7 @@  discard block
 block discarded – undo
48 45
             $name = substr($name,3);
49 46
             if (isset($arguments[0])) {
50 47
                 $this->$name = $arguments[0];
51
-            }
52
-            elseif (isset($arguments['value'])) {
48
+            } elseif (isset($arguments['value'])) {
53 49
                 $this->$name = $arguments['value'];
54 50
             }
55 51
         }
Please login to merge, or discard this patch.
src/tools/encrypt.php 1 patch
Braces   +7 added lines, -9 removed lines patch added patch discarded remove patch
@@ -36,24 +36,20 @@  discard block
 block discarded – undo
36 36
                 $iv = self::randomString();
37 37
                 $output = base64_encode(openssl_encrypt($text, 'AES-256-CBC', $key, 1, $iv));
38 38
                 return ['hash' => $output, 'key' => $key, 'iv' => $iv];
39
-            }
40
-            elseif ($action === cryptoAction::DECRYPT) {
39
+            } elseif ($action === cryptoAction::DECRYPT) {
41 40
                 if (empty($key)) {
42 41
                     logger::write("tools::crypto function used\nkey parameter is not set",loggerTypes::ERROR);
43 42
                     throw new bptException('ARGUMENT_NOT_FOUND_KEY');
44
-                }
45
-                elseif (empty($iv)) {
43
+                } elseif (empty($iv)) {
46 44
                     logger::write("tools::crypto function used\niv parameter is not set",loggerTypes::ERROR);
47 45
                     throw new bptException('ARGUMENT_NOT_FOUND_IV');
48 46
                 }
49 47
                 return openssl_decrypt(base64_decode($text), 'AES-256-CBC', $key, 1, $iv);
50
-            }
51
-            else {
48
+            } else {
52 49
                 logger::write("tools::crypto function used\naction is not right, its must be `encode` or `decode`",loggerTypes::WARNING);
53 50
                 return false;
54 51
             }
55
-        }
56
-        else {
52
+        } else {
57 53
             logger::write("tools::crypto function used\nopenssl extension is not found , It may not be installed or enabled",loggerTypes::ERROR);
58 54
             throw new bptException('OPENSSL_EXTENSION_MISSING');
59 55
         }
@@ -75,7 +71,9 @@  discard block
 block discarded – undo
75 71
             $array[] = $num % 62;
76 72
             $num = floor($num / 62);
77 73
         }
78
-        if (count($array) < 1) $array = [0];
74
+        if (count($array) < 1) {
75
+            $array = [0];
76
+        }
79 77
         foreach ($array as &$value) {
80 78
             $value = $codes[$value];
81 79
         }
Please login to merge, or discard this patch.