Passed
Push — master ( 6b9ef6...4302eb )
by Stefan
10:02
created
core/DBConnection.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
             case "EXTERNAL":
61 61
             case "FRONTEND":
62 62
             case "DIAGNOSTICS":
63
-                if (!isset(self::${"instance" . $theDb})) {
63
+                if (!isset(self::${"instance".$theDb})) {
64 64
                     $class = __CLASS__;
65
-                    self::${"instance" . $theDb} = new $class($database);
66
-                    DBConnection::${"instance" . $theDb}->databaseInstance = $theDb;
65
+                    self::${"instance".$theDb} = new $class($database);
66
+                    DBConnection::${"instance".$theDb}->databaseInstance = $theDb;
67 67
                 }
68
-                return self::${"instance" . $theDb};
68
+                return self::${"instance".$theDb};
69 69
             default:
70
-                throw new Exception("This type of database (" . strtoupper($database) . ") is not known!");
70
+                throw new Exception("This type of database (".strtoupper($database).") is not known!");
71 71
         }
72 72
     }
73 73
 
@@ -106,18 +106,18 @@  discard block
 block discarded – undo
106 106
             }
107 107
         }
108 108
         // log exact query to debug log, if log level is at 5
109
-        $this->loggerInstance->debug(5, "DB ATTEMPT: " . $querystring . "\n");
109
+        $this->loggerInstance->debug(5, "DB ATTEMPT: ".$querystring."\n");
110 110
         if ($types !== NULL) {
111
-            $this->loggerInstance->debug(5, "Argument type sequence: $types, parameters are: " . print_r($arguments, true));
111
+            $this->loggerInstance->debug(5, "Argument type sequence: $types, parameters are: ".print_r($arguments, true));
112 112
         }
113 113
 
114 114
         if ($this->connection->connect_error) {
115
-            throw new Exception("ERROR: Cannot send query to $this->databaseInstance database (no connection, error number" . $this->connection->connect_error . ")!");
115
+            throw new Exception("ERROR: Cannot send query to $this->databaseInstance database (no connection, error number".$this->connection->connect_error.")!");
116 116
         }
117 117
         if ($types === NULL) {
118 118
             $result = $this->connection->query($querystring);
119 119
             if ($result === FALSE) {
120
-                throw new Exception("DB: Unable to execute simple statement! Error was --> " . $this->connection->error . " <--");
120
+                throw new Exception("DB: Unable to execute simple statement! Error was --> ".$this->connection->error." <--");
121 121
             }
122 122
         } else {
123 123
             // fancy! prepared statement with dedicated argument list
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
                 }
134 134
                 $prepResult = $statementObject->prepare($querystring);
135 135
                 if ($prepResult === FALSE) {
136
-                    throw new Exception("DB: Unable to prepare statement! Statement was --> $querystring <--, error was --> " . $statementObject->error . " <--.");
136
+                    throw new Exception("DB: Unable to prepare statement! Statement was --> $querystring <--, error was --> ".$statementObject->error." <--.");
137 137
                 }
138 138
                 $this->preparedStatements[$querystring] = $statementObject;
139 139
             }
@@ -146,11 +146,11 @@  discard block
 block discarded – undo
146 146
             array_unshift($localArray, $types);
147 147
             $retval = call_user_func_array([$statementObject, "bind_param"], $localArray);
148 148
             if ($retval === FALSE) {
149
-                throw new Exception("DB: Unable to bind parameters to prepared statement! Argument array was --> " . var_export($localArray, TRUE) . " <--. Error was --> " . $statementObject->error . " <--");
149
+                throw new Exception("DB: Unable to bind parameters to prepared statement! Argument array was --> ".var_export($localArray, TRUE)." <--. Error was --> ".$statementObject->error." <--");
150 150
             }
151 151
             $result = $statementObject->execute();
152 152
             if ($result === FALSE) {
153
-                throw new Exception("DB: Unable to execute prepared statement! Error was --> " . $statementObject->error . " <--");
153
+                throw new Exception("DB: Unable to execute prepared statement! Error was --> ".$statementObject->error." <--");
154 154
             }
155 155
             $selectResult = $statementObject->get_result();
156 156
             if ($selectResult !== FALSE) {
@@ -160,14 +160,14 @@  discard block
 block discarded – undo
160 160
 
161 161
         // all cases where $result could be FALSE have been caught earlier
162 162
         if ($this->connection->errno) {
163
-            throw new Exception("ERROR: Cannot execute query in $this->databaseInstance database - (hopefully escaped) query was '$querystring', errno was " . $this->connection->errno . "!");
163
+            throw new Exception("ERROR: Cannot execute query in $this->databaseInstance database - (hopefully escaped) query was '$querystring', errno was ".$this->connection->errno."!");
164 164
         }
165 165
 
166 166
 
167 167
         if ($isMoreThanSelect) {
168
-            $this->loggerInstance->writeSQLAudit("[DB: " . strtoupper($this->databaseInstance) . "] " . $querystring);
168
+            $this->loggerInstance->writeSQLAudit("[DB: ".strtoupper($this->databaseInstance)."] ".$querystring);
169 169
             if ($types !== NULL) {
170
-                $this->loggerInstance->writeSQLAudit("Argument type sequence: $types, parameters are: " . print_r($arguments, true));
170
+                $this->loggerInstance->writeSQLAudit("Argument type sequence: $types, parameters are: ".print_r($arguments, true));
171 171
             }
172 172
         }
173 173
         return $result;
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
         $databaseCapitalised = strtoupper($database);
253 253
         $this->connection = new \mysqli(\config\Master::DB[$databaseCapitalised]['host'], \config\Master::DB[$databaseCapitalised]['user'], \config\Master::DB[$databaseCapitalised]['pass'], \config\Master::DB[$databaseCapitalised]['db']);
254 254
         if ($this->connection->connect_error) {
255
-            throw new Exception("ERROR: Unable to connect to $database database! This is a fatal error, giving up (error number " . $this->connection->connect_errno . ").");
255
+            throw new Exception("ERROR: Unable to connect to $database database! This is a fatal error, giving up (error number ".$this->connection->connect_errno.").");
256 256
         }
257 257
         $this->readOnly = \config\Master::DB[$databaseCapitalised]['readonly'];
258 258
     }
Please login to merge, or discard this patch.