Passed
Push — 1.0.0-dev ( d422fd...3d5bea )
by nguereza
02:49
created
tests/include/autoloader.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,8 +43,7 @@
 block discarded – undo
43 43
 		if(isset($classesMap[$class])){
44 44
 			if(file_exists($classesMap[$class])){
45 45
 				require_once $classesMap[$class];
46
-			}
47
-			else{
46
+			} else{
48 47
 				echo 'File for class ' . $class . ' not found';
49 48
 			}
50 49
 		}
Please login to merge, or discard this patch.
core/common.php 1 patch
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -226,16 +226,14 @@  discard block
 block discarded – undo
226 226
 							);
227 227
 			if (isset($http_status[$code])){
228 228
 				$text = $http_status[$code];
229
-			}
230
-			else{
229
+			} else{
231 230
 				show_error('No HTTP status text found for your code please check it.');
232 231
 			}
233 232
 		}
234 233
 		
235 234
 		if (strpos(php_sapi_name(), 'cgi') === 0){
236 235
 			header('Status: ' . $code . ' ' . $text, TRUE);
237
-		}
238
-		else{
236
+		} else{
239 237
 			$proto = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1';
240 238
 			header($proto . ' ' . $code . ' ' . $text, TRUE, $code);
241 239
 		}
@@ -277,11 +275,9 @@  discard block
 block discarded – undo
277 275
 		*/
278 276
 		if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off'){
279 277
 			return true;
280
-		}
281
-		else if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https'){
278
+		} else if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https'){
282 279
 			return true;
283
-		}
284
-		else if (isset($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off'){
280
+		} else if (isset($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off'){
285 281
 			return true;
286 282
 		}
287 283
 		return false;
@@ -324,8 +320,7 @@  discard block
 block discarded – undo
324 320
 	function php_exception_handler($ex){
325 321
 		if (str_ireplace(array('off', 'none', 'no', 'false', 'null'), '', ini_get('display_errors'))){
326 322
 			show_error('An exception is occured in file '. $ex->getFile() .' at line ' . $ex->getLine() . ' raison : ' . $ex->getMessage(), 'PHP Exception #' . $ex->getCode());
327
-		}
328
-		else{
323
+		} else{
329 324
 			save_to_log('error', 'An exception is occured in file ' . $ex->getFile() . ' at line ' . $ex->getLine() . ' raison : ' . $ex->getMessage(), 'PHP Exception');
330 325
 		}
331 326
 		return true;
@@ -447,15 +442,13 @@  discard block
 block discarded – undo
447 442
 	function clean_input($str){
448 443
 		if (is_array($str)){
449 444
 			$str = array_map('clean_input', $str);
450
-		}
451
-		else if (is_object($str)){
445
+		} else if (is_object($str)){
452 446
 			$obj = $str;
453 447
 			foreach ($str as $var => $value) {
454 448
 				$obj->$var = clean_input($value);
455 449
 			}
456 450
 			$str = $obj;
457
-		}
458
-		else{
451
+		} else{
459 452
 			$str = htmlspecialchars(strip_tags($str), ENT_QUOTES, 'UTF-8');
460 453
 		}
461 454
 		return $str;
@@ -528,8 +521,7 @@  discard block
 block discarded – undo
528 521
 					session_save_path($sessionSavePath);
529 522
 					$logger->info('Session save path: ' . $sessionSavePath);
530 523
 				}
531
-			}
532
-			else if ($sessionHandler == 'database'){
524
+			} else if ($sessionHandler == 'database'){
533 525
 				//load database session handle library
534 526
 				//Database Session handler Model
535 527
 				require_once CORE_CLASSES_MODEL_PATH . 'DBSessionHandlerModel.php';
@@ -537,8 +529,7 @@  discard block
 block discarded – undo
537 529
 				$DBS =& class_loader('DBSessionHandler', 'classes');
538 530
 				session_set_save_handler($DBS, true);
539 531
 				$logger->info('session save path: ' . get_config('session_save_path'));
540
-			}
541
-			else{
532
+			} else{
542 533
 				show_error('Invalid session handler configuration');
543 534
 			}
544 535
 			$lifetime = get_config('session_cookie_lifetime', 0);
Please login to merge, or discard this patch.
core/classes/model/Model.php 1 patch
Braces   +32 added lines, -64 removed lines patch added patch discarded remove patch
@@ -143,8 +143,7 @@  discard block
 block discarded – undo
143 143
         public function __construct(Database $db = null){
144 144
             if (is_object($db)){
145 145
                 $this->setDatabaseInstance($db);
146
-            }
147
-            else{
146
+            } else{
148 147
                 $obj = & get_instance();
149 148
         		if (isset($obj->database) && is_object($obj->database)){
150 149
                     /**
@@ -260,8 +259,7 @@  discard block
 block discarded – undo
260 259
                 $this->trigger('after_create', $insert_id);
261 260
 				//if the table doesn't have the auto increment field or sequence, the value of 0 will be returned 
262 261
 				return ! $insert_id ? true : $insert_id;
263
-            }
264
-            else
262
+            } else
265 263
             {
266 264
                 return FALSE;
267 265
             }
@@ -298,8 +296,7 @@  discard block
 block discarded – undo
298 296
                 $result = $this->_database->update($data, $escape);
299 297
                 $this->trigger('after_update', array($data, $result));
300 298
                 return $result;
301
-            }
302
-            else
299
+            } else
303 300
             {
304 301
                 return FALSE;
305 302
             }
@@ -322,8 +319,7 @@  discard block
 block discarded – undo
322 319
 				$result = $this->_database->update($data, $escape);
323 320
                 $this->trigger('after_update', array($data, $result));
324 321
                 return $result;
325
-            }
326
-            else
322
+            } else
327 323
             {
328 324
                 return FALSE;
329 325
             }
@@ -340,8 +336,7 @@  discard block
 block discarded – undo
340 336
                 if (is_array($args[1])){
341 337
                     $data = array_pop($args);
342 338
                 }
343
-            }
344
-            else if (count($args) == 3){
339
+            } else if (count($args) == 3){
345 340
                 if (is_array($args[2])){
346 341
                     $data = array_pop($args);
347 342
                 }
@@ -354,8 +349,7 @@  discard block
 block discarded – undo
354 349
 				$result = $this->_database->update($data);
355 350
                 $this->trigger('after_update', array($data, $result));
356 351
                 return $result;
357
-            }
358
-            else
352
+            } else
359 353
             {
360 354
                 return FALSE;
361 355
             }
@@ -385,8 +379,7 @@  discard block
 block discarded – undo
385 379
             {
386 380
                 $this->getQueryBuilder()->from($this->_table);	
387 381
 				$result = $this->_database->update(array( $this->soft_delete_key => TRUE ));
388
-            }
389
-            else
382
+            } else
390 383
             {
391 384
                 $this->getQueryBuilder()->from($this->_table); 
392 385
 				$result = $this->_database->delete();
@@ -409,8 +402,7 @@  discard block
 block discarded – undo
409 402
             {
410 403
                 $this->getQueryBuilder()->from($this->_table);	
411 404
 				$result = $this->_database->update(array( $this->soft_delete_key => TRUE ));
412
-            }
413
-            else
405
+            } else
414 406
             {
415 407
                 $this->getQueryBuilder()->from($this->_table); 
416 408
 				$result = $this->_database->delete();
@@ -431,8 +423,7 @@  discard block
 block discarded – undo
431 423
             {
432 424
                 $this->getQueryBuilder()->from($this->_table);	
433 425
 				$result = $this->_database->update(array( $this->soft_delete_key => TRUE ));
434
-            }
435
-            else
426
+            } else
436 427
             {
437 428
                 $this->getQueryBuilder()->from($this->_table); 
438 429
 				$result = $this->_database->delete();
@@ -494,8 +485,7 @@  discard block
 block discarded – undo
494 485
             if (count($args) == 2)
495 486
             {
496 487
                 list($key, $value) = $args;
497
-            }
498
-            else
488
+            } else
499 489
             {
500 490
                 $key = $this->primary_key;
501 491
                 $value = $args[0];
@@ -647,8 +637,7 @@  discard block
 block discarded – undo
647 637
             if (is_object($row))
648 638
             {
649 639
                 $row->created_at = date('Y-m-d H:i:s');
650
-            }
651
-            else
640
+            } else
652 641
             {
653 642
                 $row['created_at'] = date('Y-m-d H:i:s');
654 643
             }
@@ -660,8 +649,7 @@  discard block
 block discarded – undo
660 649
             if (is_object($row))
661 650
             {
662 651
                 $row->updated_at = date('Y-m-d H:i:s');
663
-            }
664
-            else
652
+            } else
665 653
             {
666 654
                 $row['updated_at'] = date('Y-m-d H:i:s');
667 655
             }
@@ -688,8 +676,7 @@  discard block
 block discarded – undo
688 676
                 if (is_array($row))
689 677
                 {
690 678
                     $row[$column] = unserialize($row[$column]);
691
-                }
692
-                else
679
+                } else
693 680
                 {
694 681
                     $row->$column = unserialize($row->$column);
695 682
                 }
@@ -709,8 +696,7 @@  discard block
 block discarded – undo
709 696
 					if (isset($row->$attr)){
710 697
 						unset($row->$attr);
711 698
 					}
712
-                }
713
-                else
699
+                } else
714 700
                 {
715 701
 					if (isset($row[$attr])){
716 702
 						unset($row[$attr]);
@@ -810,8 +796,7 @@  discard block
 block discarded – undo
810 796
                 {
811 797
                     $this->getQueryBuilder()->orderBy($key, $value);
812 798
                 }
813
-            }
814
-            else
799
+            } else
815 800
             {
816 801
                 $this->getQueryBuilder()->orderBy($criteria, $order);
817 802
             }
@@ -842,8 +827,7 @@  discard block
 block discarded – undo
842 827
                 {
843 828
                     $relationship = $value;
844 829
                     $options = array( 'primary_key' => $value . '_id', 'model' => $value . '_model' );
845
-                }
846
-                else
830
+                } else
847 831
                 {
848 832
                     $relationship = $key;
849 833
                     $options = $value;
@@ -853,15 +837,13 @@  discard block
 block discarded – undo
853 837
                 {
854 838
                     if (is_object($this->loaderInstance)){
855 839
                         $this->loaderInstance->model($options['model'], $relationship . '_model');
856
-                    }
857
-                    else{
840
+                    } else{
858 841
                         Loader::model($options['model'], $relationship . '_model');    
859 842
                     }
860 843
                     if (is_object($row))
861 844
                     {
862 845
                         $row->{$relationship} = $this->{$relationship . '_model'}->get($row->{$options['primary_key']});
863
-                    }
864
-                    else
846
+                    } else
865 847
                     {
866 848
                         $row[$relationship] = $this->{$relationship . '_model'}->get($row[$options['primary_key']]);
867 849
                     }
@@ -881,8 +863,7 @@  discard block
 block discarded – undo
881 863
                 {
882 864
                     $relationship = $value;
883 865
                     $options = array( 'primary_key' => $this->_table . '_id', 'model' => $value . '_model' );
884
-                }
885
-                else
866
+                } else
886 867
                 {
887 868
                     $relationship = $key;
888 869
                     $options = $value;
@@ -892,15 +873,13 @@  discard block
 block discarded – undo
892 873
                 {
893 874
                     if (is_object($this->loaderInstance)){
894 875
                         $this->loaderInstance->model($options['model'], $relationship . '_model');
895
-                    }
896
-                    else{
876
+                    } else{
897 877
                         Loader::model($options['model'], $relationship . '_model');    
898 878
                     }
899 879
                     if (is_object($row))
900 880
                     {
901 881
                         $row->{$relationship} = $this->{$relationship . '_model'}->get_many_by($options['primary_key'], $row->{$this->primary_key});
902
-                    }
903
-                    else
882
+                    } else
904 883
                     {
905 884
                         $row[$relationship] = $this->{$relationship . '_model'}->get_many_by($options['primary_key'], $row[$this->primary_key]);
906 885
                     }
@@ -946,8 +925,7 @@  discard block
 block discarded – undo
946 925
                 $fv = null;
947 926
                 if (is_object($this->formValidationInstance)){
948 927
                     $fv = $this->formValidationInstance;
949
-                }
950
-                else{
928
+                } else{
951 929
                     Loader::library('FormValidation');
952 930
                     $fv = $this->formvalidation;
953 931
                     $this->setFormValidation($fv);
@@ -959,13 +937,11 @@  discard block
 block discarded – undo
959 937
                 if ($fv->run())
960 938
                 {
961 939
                     return $data;
962
-                }
963
-                else
940
+                } else
964 941
                 {
965 942
                     return FALSE;
966 943
                 }
967
-            }
968
-            else
944
+            } else
969 945
             {
970 946
                 return $data;
971 947
             }
@@ -982,14 +958,12 @@  discard block
 block discarded – undo
982 958
 				if (is_array($filter))
983 959
 				{
984 960
 					$this->getQueryBuilder()->in($field, $filter);
985
-				}
986
-				else
961
+				} else
987 962
 				{
988 963
 					if (is_int($field))
989 964
 					{
990 965
 						$this->getQueryBuilder()->where($filter);
991
-					}
992
-					else
966
+					} else
993 967
 					{
994 968
 						$this->getQueryBuilder()->where($field, $filter);
995 969
 					}
@@ -1006,33 +980,27 @@  discard block
 block discarded – undo
1006 980
             if (count($params) == 1 && is_array($params[0]))
1007 981
             {
1008 982
                 $this->_set_where_array($params[0]);
1009
-            }
1010
-            else if (count($params) == 1)
983
+            } else if (count($params) == 1)
1011 984
             {
1012 985
                 $this->getQueryBuilder()->where($params[0]);
1013
-            }
1014
-        	else if (count($params) == 2)
986
+            } else if (count($params) == 2)
1015 987
     		{
1016 988
                 if (is_array($params[1]))
1017 989
                 {
1018 990
                     $this->getQueryBuilder()->in($params[0], $params[1]);
1019
-                }
1020
-                else
991
+                } else
1021 992
                 {
1022 993
                     $this->getQueryBuilder()->where($params[0], $params[1]);
1023 994
                 }
1024
-    		}
1025
-    		else if (count($params) == 3)
995
+    		} else if (count($params) == 3)
1026 996
     		{
1027 997
     			$this->getQueryBuilder()->where($params[0], $params[1], $params[2]);
1028
-    		}
1029
-            else
998
+    		} else
1030 999
             {
1031 1000
                 if (is_array($params[1]))
1032 1001
                 {
1033 1002
                     $this->getQueryBuilder()->in($params[0], $params[1]);
1034
-                }
1035
-                else
1003
+                } else
1036 1004
                 {
1037 1005
                     $this->getQueryBuilder()->where($params[0], $params[1]);
1038 1006
                 }
Please login to merge, or discard this patch.
core/classes/Response.php 1 patch
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -152,8 +152,7 @@  discard block
 block discarded – undo
152 152
 			if(! headers_sent()){
153 153
 				header('Location: '.$url);
154 154
 				exit;
155
-			}
156
-			else{
155
+			} else{
157 156
 				echo '<script>
158 157
 						location.href = "'.$url.'";
159 158
 					</script>';
@@ -202,12 +201,10 @@  discard block
 block discarded – undo
202 201
 					if($moduleViewPath){
203 202
 						$path = $moduleViewPath;
204 203
 						$logger->info('Found view [' . $view . '] in module [' .$mod. '], the file path is [' .$moduleViewPath. '] we will used it');
205
-					}
206
-					else{
204
+					} else{
207 205
 						$logger->info('Cannot find view [' . $view . '] in module [' .$mod. '] using the default location');
208 206
 					}
209
-				}
210
-				else{
207
+				} else{
211 208
 					$logger->info('The current request does not use module using the default location.');
212 209
 				}
213 210
 			}
@@ -326,8 +323,7 @@  discard block
 block discarded – undo
326 323
 					$logger->info('The cache page content is not yet expire for the URL [' . $url . '] send 304 header to browser');
327 324
 					self::sendHeaders(304);
328 325
 					return;
329
-				}
330
-				else{
326
+				} else{
331 327
 					$logger->info('The cache page content is expired or the browser don\'t send the HTTP_IF_MODIFIED_SINCE header for the URL [' . $url . '] send cache headers to tell the browser');
332 328
 					self::sendHeaders(200);
333 329
 					//get the cache content
@@ -347,15 +343,13 @@  discard block
 block discarded – undo
347 343
 						//compress the output if is available
348 344
 						if (self::$_canCompressOutput){
349 345
 							ob_start('ob_gzhandler');
350
-						}
351
-						else{
346
+						} else{
352 347
 							ob_start();
353 348
 						}
354 349
 						echo $content;
355 350
 						ob_end_flush();
356 351
 						return;
357
-					}
358
-					else{
352
+					} else{
359 353
 						$logger->info('The page cache content for the URL [' . $url . '] is not valid may be already expired');
360 354
 						$cache->delete($pageCacheKey);
361 355
 					}
@@ -396,16 +390,14 @@  discard block
 block discarded – undo
396 390
 				//compress the output if is available
397 391
 				if (self::$_canCompressOutput){
398 392
 					ob_start('ob_gzhandler');
399
-				}
400
-				else{
393
+				} else{
401 394
 					ob_start();
402 395
 				}
403 396
 				require_once $path;
404 397
 				$output = ob_get_clean();
405 398
 				self::sendHeaders(404);
406 399
 				echo $output;
407
-			}
408
-			else{
400
+			} else{
409 401
 				show_error('The 404 view [' .$path. '] does not exist');
410 402
 			}
411 403
 		}
@@ -420,8 +412,7 @@  discard block
 block discarded – undo
420 412
 				//compress the output if exists
421 413
 				if (self::$_canCompressOutput){
422 414
 					ob_start('ob_gzhandler');
423
-				}
424
-				else{
415
+				} else{
425 416
 					ob_start();
426 417
 				}
427 418
 				extract($data);
@@ -429,8 +420,7 @@  discard block
 block discarded – undo
429 420
 				$output = ob_get_clean();
430 421
 				self::sendHeaders(503);
431 422
 				echo $output;
432
-			}
433
-			else{
423
+			} else{
434 424
 				//can't use show_error() at this time because some dependencies not yet loaded and to prevent loop
435 425
 				set_http_status_header(503);
436 426
 				echo 'The error view [' . $path . '] does not exist';
Please login to merge, or discard this patch.
core/classes/Module.php 1 patch
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -61,8 +61,7 @@  discard block
 block discarded – undo
61 61
 				while(($module = readdir($moduleDir)) !== false){
62 62
 					if(preg_match('/^([a-z0-9-_]+)$/i', $module) && is_dir(MODULE_PATH . $module)){
63 63
 						self::$list[] = $module;
64
-					}
65
-					else{
64
+					} else{
66 65
 						$logger->info('Skipping [' .$module. '], may be this is not a directory or does not exists or is invalid name');
67 66
 					}
68 67
 				}
@@ -152,8 +151,7 @@  discard block
 block discarded – undo
152 151
 			if(file_exists($filePath)){
153 152
 				$logger->info('Found controller [' . $class . '] in module [' .$module. '], the file path is [' .$filePath. ']');
154 153
 				return $filePath;
155
-			}
156
-			else{
154
+			} else{
157 155
 				$logger->info('Controller [' . $class . '] does not exist in the module [' .$module. ']');
158 156
 				return false;
159 157
 			}
@@ -179,8 +177,7 @@  discard block
 block discarded – undo
179 177
 			if(file_exists($filePath)){
180 178
 				$logger->info('Found model [' . $class . '] in module [' .$module. '], the file path is [' .$filePath. ']');
181 179
 				return $filePath;
182
-			}
183
-			else{
180
+			} else{
184 181
 				$logger->info('Model [' . $class . '] does not exist in the module [' .$module. ']');
185 182
 				return false;
186 183
 			}
@@ -205,8 +202,7 @@  discard block
 block discarded – undo
205 202
 			if(file_exists($filePath)){
206 203
 				$logger->info('Found configuration [' . $configuration . '] in module [' .$module. '], the file path is [' .$filePath. ']');
207 204
 				return $filePath;
208
-			}
209
-			else{
205
+			} else{
210 206
 				$logger->info('Configuration [' . $configuration . '] does not exist in the module [' .$module. ']');
211 207
 				return false;
212 208
 			}
@@ -232,8 +228,7 @@  discard block
 block discarded – undo
232 228
 			if(file_exists($filePath)){
233 229
 				$logger->info('Found helper [' . $helper . '] in module [' .$module. '], the file path is [' .$filePath. ']');
234 230
 				return $filePath;
235
-			}
236
-			else{
231
+			} else{
237 232
 				$logger->info('Helper [' . $helper . '] does not exist in the module [' .$module. ']');
238 233
 				return false;
239 234
 			}
@@ -259,8 +254,7 @@  discard block
 block discarded – undo
259 254
 			if(file_exists($filePath)){
260 255
 				$logger->info('Found library [' . $class . '] in module [' .$module. '], the file path is [' .$filePath. ']');
261 256
 				return $filePath;
262
-			}
263
-			else{
257
+			} else{
264 258
 				$logger->info('Library [' . $class . '] does not exist in the module [' .$module. ']');
265 259
 				return false;
266 260
 			}
@@ -288,8 +282,7 @@  discard block
 block discarded – undo
288 282
 			if(file_exists($filePath)){
289 283
 				$logger->info('Found view [' . $view . '] in module [' .$module. '], the file path is [' .$filePath. ']');
290 284
 				return $filePath;
291
-			}
292
-			else{
285
+			} else{
293 286
 				$logger->info('View [' . $view . '] does not exist in the module [' .$module. ']');
294 287
 				return false;
295 288
 			}
@@ -316,8 +309,7 @@  discard block
 block discarded – undo
316 309
 			if(file_exists($filePath)){
317 310
 				$logger->info('Found language [' . $language . '] in module [' .$module. '], the file path is [' .$filePath. ']');
318 311
 				return $filePath;
319
-			}
320
-			else{
312
+			} else{
321 313
 				$logger->info('Language [' . $language . '] does not exist in the module [' .$module. ']');
322 314
 				return false;
323 315
 			}
Please login to merge, or discard this patch.
core/libraries/Upload.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -477,8 +477,7 @@  discard block
 block discarded – undo
477 477
                     if (mkdir($destination_directory, 0775, true)) {
478 478
                         $this->destination_directory = $destination_directory;
479 479
                         chdir($destination_directory);
480
-                    }
481
-                    else{
480
+                    } else{
482 481
                         $this->logger->warning('Can not create the upload directory [' .$destination_directory. ']');
483 482
                     }
484 483
                 }
@@ -630,8 +629,7 @@  discard block
 block discarded – undo
630 629
                 // set original filename if not have a new name
631 630
                 if (empty($this->filename)) {
632 631
                     $this->filename = $this->file_array[$this->input]['name'];
633
-                }
634
-                else{
632
+                } else{
635 633
                     // Replace %s for extension in filename
636 634
                     // Before: /[\w\d]*(.[\d\w]+)$/i
637 635
                     // After: /^[\s[:alnum:]\-\_\.]*\.([\d\w]+)$/iu
Please login to merge, or discard this patch.
core/classes/database/DatabaseQueryBuilder.php 1 patch
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -225,8 +225,7 @@  discard block
 block discarded – undo
225 225
       }
226 226
       if (empty($this->join)){
227 227
         $this->join = ' ' . $type . 'JOIN' . ' ' . $table . ' ON ' . $on;
228
-      }
229
-      else{
228
+      } else{
230 229
         $this->join = $this->join . ' ' . $type . 'JOIN' . ' ' . $table . ' ON ' . $on;
231 230
       }
232 231
       return $this;
@@ -334,8 +333,7 @@  discard block
 block discarded – undo
334 333
       $whereStr = '';
335 334
       if (is_array($where)){
336 335
         $whereStr = $this->getWhereStrIfIsArray($where, $type, $andOr, $escape);
337
-      }
338
-      else{
336
+      } else{
339 337
         if (is_array($op)){
340 338
           $whereStr = $this->getWhereStrIfOperatorIsArray($where, $op, $type, $escape);
341 339
         } else {
@@ -585,8 +583,7 @@  discard block
 block discarded – undo
585 583
       }
586 584
       if (! is_null($limitEnd)){
587 585
         $this->limit = $limit . ', ' . $limitEnd;
588
-      }
589
-      else{
586
+      } else{
590 587
         $this->limit = $limit;
591 588
       }
592 589
       return $this;
@@ -601,8 +598,7 @@  discard block
 block discarded – undo
601 598
     public function orderBy($orderBy, $orderDir = ' ASC'){
602 599
       if (stristr($orderBy, ' ') || $orderBy == 'rand()'){
603 600
         $this->orderBy = empty($this->orderBy) ? $orderBy : $this->orderBy . ', ' . $orderBy;
604
-      }
605
-      else{
601
+      } else{
606 602
         $this->orderBy = empty($this->orderBy) 
607 603
 						? ($orderBy . ' ' . strtoupper($orderDir)) 
608 604
 						: $this->orderBy . ', ' . $orderBy . ' ' . strtoupper($orderDir);
@@ -618,8 +614,7 @@  discard block
 block discarded – undo
618 614
     public function groupBy($field){
619 615
       if (is_array($field)){
620 616
         $this->groupBy = implode(', ', $field);
621
-      }
622
-      else{
617
+      } else{
623 618
         $this->groupBy = $field;
624 619
       }
625 620
       return $this;
@@ -636,14 +631,12 @@  discard block
 block discarded – undo
636 631
     public function having($field, $op = null, $val = null, $escape = true){
637 632
       if (is_array($op)){
638 633
         $this->having = $this->getHavingStrIfOperatorIsArray($field, $op, $escape);
639
-      }
640
-      else if (! in_array($op, $this->operatorList)){
634
+      } else if (! in_array($op, $this->operatorList)){
641 635
         if (is_null($op)){
642 636
           $op = '';
643 637
         }
644 638
         $this->having = $field . ' > ' . ($this->escape($op, $escape));
645
-      }
646
-      else{
639
+      } else{
647 640
         if (is_null($val)){
648 641
           $val = '';
649 642
         }
Please login to merge, or discard this patch.
core/classes/database/DatabaseQueryRunner.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -149,8 +149,7 @@  discard block
 block discarded – undo
149 149
           $isSqlSELECTQuery = stristr($this->query, 'SELECT') !== false;
150 150
           if($isSqlSELECTQuery){
151 151
               $this->setResultForSelect();              
152
-          }
153
-          else{
152
+          } else{
154 153
               $this->setResultForNonSelect();
155 154
           }
156 155
           return $this->queryResult;
@@ -172,15 +171,13 @@  discard block
 block discarded – undo
172 171
       }
173 172
       if ($this->returnAsList){
174 173
           $result = $this->pdoStatment->fetchAll($fetchMode);
175
-      }
176
-      else{
174
+      } else{
177 175
           $result = $this->pdoStatment->fetch($fetchMode);
178 176
       }
179 177
       //Sqlite and pgsql always return 0 when using rowCount()
180 178
       if (in_array($this->driver, array('sqlite', 'pgsql'))){
181 179
         $numRows = count($result);  
182
-      }
183
-      else{
180
+      } else{
184 181
         $numRows = $this->pdoStatment->rowCount(); 
185 182
       }
186 183
       if(! is_object($this->queryResult)){
@@ -201,8 +198,7 @@  discard block
 block discarded – undo
201 198
       if (in_array($this->driver, array('sqlite', 'pgsql'))){
202 199
         $result = true; //to test the result for the query like UPDATE, INSERT, DELETE
203 200
         $numRows = 1; //TODO use the correct method to get the exact affected row
204
-      }
205
-      else{
201
+      } else{
206 202
           //to test the result for the query like UPDATE, INSERT, DELETE
207 203
           $result  = $this->pdoStatment->rowCount() >= 0; 
208 204
           $numRows = $this->pdoStatment->rowCount(); 
@@ -380,8 +376,7 @@  discard block
 block discarded – undo
380 376
     protected function setLoggerFromParamOrCreateNewInstance(Log $logger = null){
381 377
       if ($logger !== null){
382 378
         $this->logger = $logger;
383
-      }
384
-      else{
379
+      } else{
385 380
           $this->logger =& class_loader('Log', 'classes');
386 381
           $this->logger->setLogger('Library::DatabaseQueryRunner');
387 382
       }
Please login to merge, or discard this patch.
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.