Passed
Push — 1.0.0-dev ( b68981...00dab9 )
by nguereza
05:23
created
core/classes/database/Database.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -151,8 +151,7 @@  discard block
 block discarded – undo
151 151
             $this->pdo->exec("SET CHARACTER SET '" . $config['charset'] . "'");
152 152
             $this->pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ);
153 153
             return true;
154
-          }
155
-          catch (PDOException $e){
154
+          } catch (PDOException $e){
156 155
             $this->logger->fatal($e->getMessage());
157 156
             show_error('Cannot connect to Database.');
158 157
             return false;
@@ -671,8 +670,7 @@  discard block
 block discarded – undo
671 670
     protected function setLoggerFromParamOrCreateNewInstance(Log $logger = null){
672 671
       if ($logger !== null){
673 672
         $this->logger = $logger;
674
-      }
675
-      else{
673
+      } else{
676 674
           $this->logger =& class_loader('Log', 'classes');
677 675
           $this->logger->setLogger('Library::Database');
678 676
       }
@@ -685,8 +683,7 @@  discard block
 block discarded – undo
685 683
 	protected function setQueryBuilderFromParamOrCreateNewInstance(DatabaseQueryBuilder $queryBuilder = null){
686 684
 	  if ($queryBuilder !== null){
687 685
         $this->queryBuilder = $queryBuilder;
688
-	  }
689
-	  else{
686
+	  } else{
690 687
 		  $this->queryBuilder =& class_loader('DatabaseQueryBuilder', 'classes/database');
691 688
 	  }
692 689
 	}
@@ -698,8 +695,7 @@  discard block
 block discarded – undo
698 695
   protected function setQueryRunnerFromParamOrCreateNewInstance(DatabaseQueryRunner $queryRunner = null){
699 696
     if ($queryRunner !== null){
700 697
         $this->queryRunner = $queryRunner;
701
-    }
702
-    else{
698
+    } else{
703 699
       $this->queryRunner =& class_loader('DatabaseQueryRunner', 'classes/database');
704 700
     }
705 701
   }
Please login to merge, or discard this patch.
core/classes/Router.php 1 patch
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -192,8 +192,7 @@  discard block
 block discarded – undo
192 192
 				$this->logger->info('The request URI contains the front controller');
193 193
 				array_shift($segment);
194 194
 				$this->segments = $segment;
195
-			}
196
-			else{
195
+			} else{
197 196
 				$this->logger->info('The request URI does not contain the front controller');
198 197
 			}
199 198
 			$uri = implode('/', $segment);
@@ -215,8 +214,7 @@  discard block
 block discarded – undo
215 214
 						$this->logger->info('The current request use the module [' .$moduleControllerMethod[0]. ']');
216 215
 						$this->module = $moduleControllerMethod[0];
217 216
 						$moduleControllerMethod = explode('@', $moduleControllerMethod[1]);
218
-					}
219
-					else{
217
+					} else{
220 218
 						$this->logger->info('The current request does not use the module');
221 219
 						$moduleControllerMethod = explode('@', $this->callback[$index]);
222 220
 					}
@@ -263,8 +261,7 @@  discard block
 block discarded – undo
263 261
 						}
264 262
 						//args
265 263
 						$this->args = $segment;
266
-					}
267
-					else{
264
+					} else{
268 265
 						$this->logger->info('The application contains a loaded module will check if the current request is found in the module list');
269 266
 						if(in_array($segment[0], $modules)){
270 267
 							$this->logger->info('Found, the current request use the module [' . $segment[0] . ']');
@@ -278,8 +275,7 @@  discard block
 block discarded – undo
278 275
 								if(! $path){
279 276
 									$this->logger->info('The controller [' . $this->getController() . '] not found in the module, may be will use the module [' . $this->getModule() . '] as controller');
280 277
 									$this->controller = $this->getModule();
281
-								}
282
-								else{
278
+								} else{
283 279
 									$this->controllerPath = $path;
284 280
 									array_shift($segment);
285 281
 								}
@@ -291,8 +287,7 @@  discard block
 block discarded – undo
291 287
 							}
292 288
 							//the remaining is for args
293 289
 							$this->args = $segment;
294
-						}
295
-						else{
290
+						} else{
296 291
 							$this->logger->info('The current request information is not found in the module list');
297 292
 							//controller
298 293
 							if(isset($segment[0])){
@@ -320,8 +315,7 @@  discard block
 block discarded – undo
320 315
 				//if it is the module controller
321 316
 				if($this->getModule()){
322 317
 					$this->controllerPath = Module::findControllerFullPath(ucfirst($this->getController()), $this->getModule());
323
-				}
324
-				else{
318
+				} else{
325 319
 					$this->controllerPath = APPS_CONTROLLER_PATH . ucfirst($this->getController()) . '.php';
326 320
 				}
327 321
 			}
@@ -336,15 +330,13 @@  discard block
 block discarded – undo
336 330
 				if(! class_exists($controller, false)){
337 331
 					$e404 = true;
338 332
 					$this->logger->info('The controller file [' .$classFilePath. '] exists but does not contain the class [' . $controller . ']');
339
-				}
340
-				else{
333
+				} else{
341 334
 					$controllerInstance = new $controller();
342 335
 					$controllerMethod = $this->getMethod();
343 336
 					if(! method_exists($controllerInstance, $controllerMethod)){
344 337
 						$e404 = true;
345 338
 						$this->logger->info('The controller [' . $controller . '] exist but does not contain the method [' . $controllerMethod . ']');
346
-					}
347
-					else{
339
+					} else{
348 340
 						$this->logger->info('Routing data is set correctly now GO!');
349 341
 						call_user_func_array(array($controllerInstance, $controllerMethod), $this->getArgs());
350 342
 						$obj = & get_instance();
@@ -353,8 +345,7 @@  discard block
 block discarded – undo
353 345
 						$obj->response->renderFinalPage();
354 346
 					}
355 347
 				}
356
-			}
357
-			else{
348
+			} else{
358 349
 				$this->logger->info('The controller file path [' . $classFilePath . '] does not exist');
359 350
 				$e404 = true;
360 351
 			}
@@ -430,8 +421,7 @@  discard block
 block discarded – undo
430 421
     protected function setLoggerFromParamOrCreateNewInstance(Log $logger = null){
431 422
       if ($logger !== null){
432 423
         $this->logger = $logger;
433
-      }
434
-      else{
424
+      } else{
435 425
           $this->logger =& class_loader('Log', 'classes');
436 426
           $this->logger->setLogger('Library::Router');
437 427
       }
Please login to merge, or discard this patch.
core/classes/Log.php 1 patch
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -215,20 +215,15 @@  discard block
 block discarded – undo
215 215
 			//the default value is NONE, so means no need test for NONE
216 216
 			if($level == 'fatal'){
217 217
 				$value = self::FATAL;
218
-			}
219
-			else if($level == 'error'){
218
+			} else if($level == 'error'){
220 219
 				$value = self::ERROR;
221
-			}
222
-			else if($level == 'warning' || $level == 'warn'){
220
+			} else if($level == 'warning' || $level == 'warn'){
223 221
 				$value = self::WARNING;
224
-			}
225
-			else if($level == 'info'){
222
+			} else if($level == 'info'){
226 223
 				$value = self::INFO;
227
-			}
228
-			else if($level == 'debug'){
224
+			} else if($level == 'debug'){
229 225
 				$value = self::DEBUG;
230
-			}
231
-			else if($level == 'all'){
226
+			} else if($level == 'all'){
232 227
 				$value = self::ALL;
233 228
 			}
234 229
 			return $value;
@@ -245,17 +240,13 @@  discard block
 block discarded – undo
245 240
 			//the default value is NONE, so means no need test for NONE
246 241
 			if($level == self::FATAL){
247 242
 				$value = 'FATAL';
248
-			}
249
-			else if($level == self::ERROR){
243
+			} else if($level == self::ERROR){
250 244
 				$value = 'ERROR';
251
-			}
252
-			else if($level == self::WARNING){
245
+			} else if($level == self::WARNING){
253 246
 				$value = 'WARNING';
254
-			}
255
-			else if($level == self::INFO){
247
+			} else if($level == self::INFO){
256 248
 				$value = 'INFO';
257
-			}
258
-			else if($level == self::DEBUG){
249
+			} else if($level == self::DEBUG){
259 250
 				$value = 'DEBUG';
260 251
 			}
261 252
 			//no need for ALL
Please login to merge, or discard this patch.
core/classes/Url.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,8 +62,7 @@
 block discarded – undo
62 62
 					$query[0] = rtrim($query[0], '/');
63 63
 					$query[0] .= $suffix;
64 64
 					$path = implode('?', $query);
65
-				}
66
-				else{
65
+				} else{
67 66
 					$path .= $suffix;
68 67
 				}
69 68
 			}
Please login to merge, or discard this patch.
core/classes/Config.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -128,8 +128,7 @@  discard block
 block discarded – undo
128 128
 				$logger->info('Delete config item ['.$item.']');
129 129
 				unset(self::$config[$item]);
130 130
 				return true;
131
-			}
132
-			else{
131
+			} else{
133 132
 				$logger->warning('Config item ['.$item.'] to be deleted does not exists');
134 133
 				return false;
135 134
 			}
@@ -166,8 +165,7 @@  discard block
 block discarded – undo
166 165
 					$port = ((($serverPort != '80' && ! is_https()) || ($serverPort != '443' && is_https())) ? ':' . $serverPort : '');
167 166
 					$baseUrl = (is_https() ? 'https' : 'http').'://' . $baseUrl . $port
168 167
 						. substr($_SERVER['SCRIPT_NAME'], 0, strpos($_SERVER['SCRIPT_NAME'], basename($_SERVER['SCRIPT_FILENAME'])));
169
-				}
170
-				else{
168
+				} else{
171 169
 					$logger->warning('Can not determine the application base URL automatically, use http://localhost as default');
172 170
 					$baseUrl = 'http://localhost/';
173 171
 				}
Please login to merge, or discard this patch.