Passed
Push — main ( aaa8c7...319ee3 )
by Alireza
04:19 queued 02:48
created
database/handller.php 2 patches
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -1,23 +1,23 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
- namespace BPT\database;
3
+    namespace BPT\database;
4 4
   
5
- use BPT\database\database;
5
+    use BPT\database\database;
6 6
  
7
-  /**
8
-   * 
9
-   */
10
-  class handller
11
-  {
12
-   /**
7
+    /**
8
+     * 
9
+     */
10
+    class handller
11
+    {
12
+    /**
13 13
      * @const types database
14 14
      */
15 15
     const TYPES = array('Mysqli','Medoo','Json');
16 16
  
17
-   /**
18
-    * @const Medoo database types
19
-    */
20
-   const Medoo_Types = array('mysql','mariadb','pgsql','sybase','oracle','mssql', 'sqlite');
17
+    /**
18
+     * @const Medoo database types
19
+     */
20
+    const Medoo_Types = array('mysql','mariadb','pgsql','sybase','oracle','mssql', 'sqlite');
21 21
 
22 22
     /**
23 23
      * @var type database
@@ -31,38 +31,38 @@  discard block
 block discarded – undo
31 31
     public static $host;
32 32
        
33 33
     /**
34
-      * @var username database username 
35
-      */
34
+     * @var username database username 
35
+     */
36 36
     public static $username;
37 37
       
38 38
     /**
39
-      * @var dbname database name
40
-      */
39
+     * @var dbname database name
40
+     */
41 41
     public static $dbname;
42 42
        
43 43
     /**
44
-      * @var charset database
45
-      */
44
+     * @var charset database
45
+     */
46 46
     public static $charset;
47 47
         
48 48
     /**
49
-      * @var password database password
50
-      */
49
+     * @var password database password
50
+     */
51 51
     public static $password;
52 52
        
53 53
     /**
54
-      * @var connection database
55
-      */
54
+     * @var connection database
55
+     */
56 56
     public static $connect;
57 57
 
58
-      /**
59
-       * 
60
-       */
61
-      public function __construct(array $settings)
62
-      {
58
+        /**
59
+         * 
60
+         */
61
+        public function __construct(array $settings)
62
+        {
63 63
         if(in_array($settings['type'],self::TYPES)){
64
-              if($settings['type'] === 'Mysqli'){
65
-                  if(self::CheckParam($settings)){
64
+                if($settings['type'] === 'Mysqli'){
65
+                    if(self::CheckParam($settings)){
66 66
                 $db = new \Mysqlidb([
67 67
                 'host' => self::$host,
68 68
                 'username' => self::$username,
@@ -70,41 +70,41 @@  discard block
 block discarded – undo
70 70
                 'db' => self::$dbname,
71 71
                 'charset' => self::$charset
72 72
                 ]); 
73
-               if($db){
74
-                  self::$connect = $db;
75
-                  print_r($db);
76
-               } else {
77
-                   print self::$username;
78
-                  throw new \exception('a problem to connecting');
79
-                 }
80
-               } else {
81
-                  throw new \exception('required parameters not found');
82
-               }
83
-             }
84
-              if($settings['type'] === 'Json'){
85
-                 if(isset($settings['dbname'])){
73
+                if($db){
74
+                    self::$connect = $db;
75
+                    print_r($db);
76
+                } else {
77
+                    print self::$username;
78
+                    throw new \exception('a problem to connecting');
79
+                    }
80
+                } else {
81
+                    throw new \exception('required parameters not found');
82
+                }
83
+                }
84
+                if($settings['type'] === 'Json'){
85
+                    if(isset($settings['dbname'])){
86 86
                 self::$type = $settings['type'];
87 87
                 self::$dbname = $settings['dbname'];
88 88
                 (new database())->json_init();
89
-              } else {
89
+                } else {
90 90
                 throw new \exception('parameter dbanme not found');
91
-             }
92
-           }
93
-         } else {
94
-             throw new \exception('parameter type not found');
95
-          }
96
-      }
91
+                }
92
+            }
93
+            } else {
94
+                throw new \exception('parameter type not found');
95
+            }
96
+        }
97 97
       
98
-      private static function CheckParam(array $array){
99
-         if(isset($array['username']) && isset($array['dbname']) && isset($array['password'])){
98
+        private static function CheckParam(array $array){
99
+            if(isset($array['username']) && isset($array['dbname']) && isset($array['password'])){
100 100
             self::$host = $array['host'] ?? 'localhost';
101 101
             self::$username = $array['username'];
102 102
             self::$dbname = $array['dbname'];
103 103
             self::$password = $array['password'];
104 104
             self::$charset = $array['charset'] ?? 'utf8';
105
-             return true;
106
-         } else {
107
-             return false;
108
-         }
109
-      }
110
-  }
111 105
\ No newline at end of file
106
+                return true;
107
+            } else {
108
+                return false;
109
+            }
110
+        }
111
+    }
112 112
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -12,12 +12,12 @@  discard block
 block discarded – undo
12 12
    /**
13 13
      * @const types database
14 14
      */
15
-    const TYPES = array('Mysqli','Medoo','Json');
15
+    const TYPES = array('Mysqli', 'Medoo', 'Json');
16 16
  
17 17
    /**
18 18
     * @const Medoo database types
19 19
     */
20
-   const Medoo_Types = array('mysql','mariadb','pgsql','sybase','oracle','mssql', 'sqlite');
20
+   const Medoo_Types = array('mysql', 'mariadb', 'pgsql', 'sybase', 'oracle', 'mssql', 'sqlite');
21 21
 
22 22
     /**
23 23
      * @var type database
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
        */
61 61
       public function __construct(array $settings)
62 62
       {
63
-        if(in_array($settings['type'],self::TYPES)){
64
-              if($settings['type'] === 'Mysqli'){
65
-                  if(self::CheckParam($settings)){
63
+        if (in_array($settings['type'], self::TYPES)) {
64
+              if ($settings['type'] === 'Mysqli') {
65
+                  if (self::CheckParam($settings)) {
66 66
                 $db = new \Mysqlidb([
67 67
                 'host' => self::$host,
68 68
                 'username' => self::$username,
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
                 'db' => self::$dbname,
71 71
                 'charset' => self::$charset
72 72
                 ]); 
73
-               if($db){
73
+               if ($db) {
74 74
                   self::$connect = $db;
75 75
                   print_r($db);
76 76
                } else {
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
                   throw new \exception('required parameters not found');
82 82
                }
83 83
              }
84
-              if($settings['type'] === 'Json'){
85
-                 if(isset($settings['dbname'])){
84
+              if ($settings['type'] === 'Json') {
85
+                 if (isset($settings['dbname'])) {
86 86
                 self::$type = $settings['type'];
87 87
                 self::$dbname = $settings['dbname'];
88 88
                 (new database())->json_init();
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
           }
96 96
       }
97 97
       
98
-      private static function CheckParam(array $array){
99
-         if(isset($array['username']) && isset($array['dbname']) && isset($array['password'])){
98
+      private static function CheckParam(array $array) {
99
+         if (isset($array['username']) && isset($array['dbname']) && isset($array['password'])) {
100 100
             self::$host = $array['host'] ?? 'localhost';
101 101
             self::$username = $array['username'];
102 102
             self::$dbname = $array['dbname'];
Please login to merge, or discard this patch.