Passed
Push — main ( b5c504...2690c9 )
by Alireza
01:51 queued 21s
created
settings.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 
24 24
     public static int $log_size = 10;
25 25
 
26
-    public static string|CURLFile|null $certificate = null;
26
+    public static string | CURLFile | null $certificate = null;
27 27
 
28 28
     public static bool $handler = true;
29 29
 
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
 
54 54
     public static array $allowed_updates = ['message', 'edited_channel_post', 'callback_query', 'inline_query'];
55 55
 
56
-    public static array|mysqli|null $db = ['type' => 'json', 'file_name' => 'BPT-DB.json'];
56
+    public static array | mysqli | null $db = ['type' => 'json', 'file_name' => 'BPT-DB.json'];
57 57
 
58 58
 
59
-    public static function init (array|stdClass $settings) {
59
+    public static function init(array | stdClass $settings) {
60 60
         $settings = (array) $settings;
61 61
 
62 62
         if (!(isset($settings['logger']) && $settings['logger'] == false)) {
@@ -64,14 +64,14 @@  discard block
 block discarded – undo
64 64
         }
65 65
 
66 66
         foreach ($settings as $setting => $value) {
67
-            try{
67
+            try {
68 68
                 self::$$setting = $value;
69 69
             }
70
-            catch (TypeError){
71
-                logger::write("$setting setting has wrong type , its set to default value",loggerTypes::WARNING);
70
+            catch (TypeError) {
71
+                logger::write("$setting setting has wrong type , its set to default value", loggerTypes::WARNING);
72 72
             }
73
-            catch (Error){
74
-                logger::write("$setting setting is not one of library settings",loggerTypes::WARNING);
73
+            catch (Error) {
74
+                logger::write("$setting setting is not one of library settings", loggerTypes::WARNING);
75 75
             }
76 76
         }
77 77
 
@@ -83,12 +83,12 @@  discard block
 block discarded – undo
83 83
                 self::$receiver !== receiver::GETUPDATES ? self::webhook() : self::getUpdates();
84 84
             }
85 85
             else {
86
-                logger::write('token format is not right, check it and try again',loggerTypes::ERROR);
86
+                logger::write('token format is not right, check it and try again', loggerTypes::ERROR);
87 87
                 throw new bptException('TOKEN_NOT_TRUE');
88 88
             }
89 89
         }
90 90
         else {
91
-            logger::write('You must specify token parameter in settings',loggerTypes::ERROR);
91
+            logger::write('You must specify token parameter in settings', loggerTypes::ERROR);
92 92
             throw new bptException('TOKEN_NOT_FOUND');
93 93
         }
94 94
     }
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         if (self::$secure_folder) {
113 113
             $address = explode('/', $_SERVER['REQUEST_URI']);
114 114
             unset($address[count($address) - 1]);
115
-            $address = implode('/', $address) . '/BPT.php';
115
+            $address = implode('/', $address).'/BPT.php';
116 116
             $text = "ErrorDocument 404 $address\nErrorDocument 403 $address\n Options -Indexes\n  Order Deny,Allow\nDeny from all\nAllow from 127.0.0.1\n<Files *.php>\n    Order Allow,Deny\n    Allow from all\n</Files>";
117 117
             if (!file_exists('.htaccess') || filesize('.htaccess') != strlen($text)) {
118 118
                 file_put_contents('.htaccess', $text);
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
             getUpdates::init();
132 132
         }
133 133
         else {
134
-            logger::write('You can\'t use getUpdates receiver when handler is off , use webhook or use handler',loggerTypes::ERROR);
134
+            logger::write('You can\'t use getUpdates receiver when handler is off , use webhook or use handler', loggerTypes::ERROR);
135 135
             throw new bptException('GETUPDATE_NEED_HANDLER');
136 136
         }
137 137
     }
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -66,11 +66,9 @@  discard block
 block discarded – undo
66 66
         foreach ($settings as $setting => $value) {
67 67
             try{
68 68
                 self::$$setting = $value;
69
-            }
70
-            catch (TypeError){
69
+            } catch (TypeError){
71 70
                 logger::write("$setting setting has wrong type , its set to default value",loggerTypes::WARNING);
72
-            }
73
-            catch (Error){
71
+            } catch (Error){
74 72
                 logger::write("$setting setting is not one of library settings",loggerTypes::WARNING);
75 73
             }
76 74
         }
@@ -81,13 +79,11 @@  discard block
 block discarded – undo
81 79
                 self::secureFolder();
82 80
                 self::db();
83 81
                 self::$receiver !== receiver::GETUPDATES ? self::webhook() : self::getUpdates();
84
-            }
85
-            else {
82
+            } else {
86 83
                 logger::write('token format is not right, check it and try again',loggerTypes::ERROR);
87 84
                 throw new bptException('TOKEN_NOT_TRUE');
88 85
             }
89
-        }
90
-        else {
86
+        } else {
91 87
             logger::write('You must specify token parameter in settings',loggerTypes::ERROR);
92 88
             throw new bptException('TOKEN_NOT_FOUND');
93 89
         }
@@ -129,8 +125,7 @@  discard block
 block discarded – undo
129 125
     private static function getUpdates() {
130 126
         if (self::$handler) {
131 127
             getUpdates::init();
132
-        }
133
-        else {
128
+        } else {
134 129
             logger::write('You can\'t use getUpdates receiver when handler is off , use webhook or use handler',loggerTypes::ERROR);
135 130
             throw new bptException('GETUPDATE_NEED_HANDLER');
136 131
         }
Please login to merge, or discard this patch.
database/database.php 2 patches
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -1,28 +1,28 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
   
3
- //define namespace
4
- namespace BPT\Database;
3
+    //define namespace
4
+    namespace BPT\Database;
5 5
  
6
- //use classes
7
- use Medoo\Medoo;
8
- use BPT\Database\JsonDb;
6
+    //use classes
7
+    use Medoo\Medoo;
8
+    use BPT\Database\JsonDb;
9 9
  
10 10
  
11
-  /**
12
-   * @class Database
13
-   */
14
-  class Database
15
-  {
11
+    /**
12
+     * @class Database
13
+     */
14
+    class Database
15
+    {
16 16
         
17
-   /**
18
-   * @const types database
19
-   */
20
-   const TYPES = array('Mysqli','Medoo','Json');
17
+    /**
18
+     * @const types database
19
+     */
20
+    const TYPES = array('Mysqli','Medoo','Json');
21 21
  
22
-   /**
23
-    * @const Medoo database types
24
-    */
25
-   const Medoo_Types = array('mysql','mariadb','pgsql','sybase','oracle','mssql', 'sqlite');
22
+    /**
23
+     * @const Medoo database types
24
+     */
25
+    const Medoo_Types = array('mysql','mariadb','pgsql','sybase','oracle','mssql', 'sqlite');
26 26
 
27 27
     /**
28 28
      * @var type database
@@ -36,40 +36,40 @@  discard block
 block discarded – undo
36 36
     protected $host;
37 37
        
38 38
     /**
39
-      * @var username database username 
40
-      */
39
+     * @var username database username 
40
+     */
41 41
     protected $username;
42 42
       
43 43
     /**
44
-      * @var dbname database name
45
-      */
44
+     * @var dbname database name
45
+     */
46 46
     protected $dbname;
47 47
        
48 48
     /**
49
-      * @var charset database
50
-      */
49
+     * @var charset database
50
+     */
51 51
     protected $charset;
52 52
         
53 53
     /**
54
-      * @var password database password
55
-      */
54
+     * @var password database password
55
+     */
56 56
     protected $password;
57 57
        
58 58
     /**
59
-      * @var connection database
60
-      */
59
+     * @var connection database
60
+     */
61 61
     protected $connect;
62 62
        
63
-      /**
64
-       * @method Json_init
65
-       * Create a Json database
66
-       */
67
-      protected function Json_init()
68
-      {
63
+        /**
64
+         * @method Json_init
65
+         * Create a Json database
66
+         */
67
+        protected function Json_init()
68
+        {
69 69
         $JsonDb = new JsonDb();
70 70
         $JsonDb->init($this->dbname);
71
-      }
71
+        }
72 72
       
73 73
       
74 74
       
75
-  }
75
+    }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,12 +17,12 @@
 block discarded – undo
17 17
    /**
18 18
    * @const types database
19 19
    */
20
-   const TYPES = array('Mysqli','Medoo','Json');
20
+   const TYPES = array('Mysqli', 'Medoo', 'Json');
21 21
  
22 22
    /**
23 23
     * @const Medoo database types
24 24
     */
25
-   const Medoo_Types = array('mysql','mariadb','pgsql','sybase','oracle','mssql', 'sqlite');
25
+   const Medoo_Types = array('mysql', 'mariadb', 'pgsql', 'sybase', 'oracle', 'mssql', 'sqlite');
26 26
 
27 27
     /**
28 28
      * @var type database
Please login to merge, or discard this patch.