Passed
Push — main ( 4122b8...60aebc )
by Miaad
01:36
created
tools/encrypt.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -36,24 +36,20 @@
 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
         }
Please login to merge, or discard this patch.
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.
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.
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.