Passed
Push — main ( b16527...3f4f52 )
by Alireza
02:30 queued 01:00
created
settings.php 1 patch
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.
database/database.php 1 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.
database/handller.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
        */
18 18
       public function __construct(array $settings)
19 19
       {
20
-        if(in_array($settings['type'],self::TYPES)){
21
-              if($settings['type'] === 'Mysqli'){
22
-                  if(self::CheckParam($settings)){
20
+        if (in_array($settings['type'], self::TYPES)) {
21
+              if ($settings['type'] === 'Mysqli') {
22
+                  if (self::CheckParam($settings)) {
23 23
                  $db = new Mysqlidb([
24 24
                 'host' => $this->host,
25 25
                 'username' => $this->username,
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
                 'db' => $this->dbname,
28 28
                 'charset' => $this->charset
29 29
                 ]);
30
-                if($db){
30
+                if ($db) {
31 31
                   $this->connect = $db;
32 32
                } else {
33 33
                   throw new \exception('a problem to connecting');
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
                   throw new \exception('required parameters not found');
37 37
                }
38 38
              }
39
-              if($settings['type'] === 'Json' and isset($settings['dbname'])){
39
+              if ($settings['type'] === 'Json' and isset($settings['dbname'])) {
40 40
                 $this->type = $settings['type'];
41 41
                 $this->dbname = $settings['dbname'];
42 42
                 parent::Json_init();
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
           }
49 49
       }
50 50
       
51
-      private static function CheckParam(array $array){
52
-         if(isset($array['username']) && isset($array['dbname']) && isset($array['password'])){
51
+      private static function CheckParam(array $array) {
52
+         if (isset($array['username']) && isset($array['dbname']) && isset($array['password'])) {
53 53
             $this->host = $array['host'] ?? 'localhost';
54 54
             $this->username = $array['username'];
55 55
             $this->dbname = $array['dbname'];
Please login to merge, or discard this patch.