Test Failed
Push — 1.0.0-dev ( 6506b5...225896 )
by nguereza
05:07
created
tests/include/autoloader.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,8 +42,7 @@
 block discarded – undo
42 42
 		if(isset($classesMap[$class])){
43 43
 			if(file_exists($classesMap[$class])){
44 44
 				include_once $classesMap[$class];
45
-			}
46
-			else{
45
+			} else{
47 46
 				echo 'File for class ' . $class . ' not found';
48 47
 			}
49 48
 		}
Please login to merge, or discard this patch.
tests/include/common.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -178,15 +178,13 @@
 block discarded – undo
178 178
 	function clean_input($str){
179 179
 		if(is_array($str)){
180 180
 			$str = array_map('clean_input', $str);
181
-		}
182
-		else if(is_object($str)){
181
+		} else if(is_object($str)){
183 182
 			$obj = $str;
184 183
 			foreach ($str as $var => $value) {
185 184
 				$obj->$var = clean_input($value);
186 185
 			}
187 186
 			$str = $obj;
188
-		}
189
-		else{
187
+		} else{
190 188
 			$str = htmlspecialchars(strip_tags($str), ENT_QUOTES, 'UTF-8');
191 189
 		}
192 190
 		return $str;
Please login to merge, or discard this patch.
core/classes/DBSessionHandler.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -87,8 +87,7 @@  discard block
 block discarded – undo
87 87
 	         */
88 88
 	        if(is_object($logger)){
89 89
 	          $this->setLogger($logger);
90
-	        }
91
-	        else{
90
+	        } else{
92 91
 	            $this->logger =& class_loader('Log', 'classes');
93 92
 	            $this->logger->setLogger('Library::DBSessionHandler');
94 93
 	        }
@@ -197,8 +196,7 @@  discard block
 block discarded – undo
197 196
 			if($this->getLoader()){
198 197
 				$this->getLoader()->functions('user_agent'); 
199 198
 				$this->getLoader()->library('Browser'); 
200
-			}
201
-			else{
199
+			} else{
202 200
             	Loader::functions('user_agent');
203 201
             	Loader::library('Browser');
204 202
             }
@@ -237,8 +235,7 @@  discard block
 block discarded – undo
237 235
 			if($this->getLoader()){
238 236
 				$this->getLoader()->functions('user_agent'); 
239 237
 				$this->getLoader()->library('Browser'); 
240
-			}
241
-			else{
238
+			} else{
242 239
             	Loader::functions('user_agent');
243 240
             	Loader::library('Browser');
244 241
             }
@@ -264,8 +261,7 @@  discard block
 block discarded – undo
264 261
 				//update
265 262
 				unset($params[$columns['sid']]);
266 263
 				$instance->update($sid, $params);
267
-			}
268
-			else{
264
+			} else{
269 265
 				$this->logger->info('Session data for SID: ' . $sid . ' not yet exists, insert it now');
270 266
 				$instance->insert($params);
271 267
 			}
Please login to merge, or discard this patch.
core/classes/model/Model.php 1 patch
Braces   +33 added lines, -66 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
                     /**
@@ -256,8 +255,7 @@  discard block
 block discarded – undo
256 255
                 $insert_id = $this->_database->insertId();
257 256
                 $this->trigger('after_create', $insert_id);
258 257
                 return $insert_id;
259
-            }
260
-            else
258
+            } else
261 259
             {
262 260
                 return FALSE;
263 261
             }
@@ -294,8 +292,7 @@  discard block
 block discarded – undo
294 292
                                    ->update($data, $escape);
295 293
                 $this->trigger('after_update', array($data, $result));
296 294
                 return $result;
297
-            }
298
-            else
295
+            } else
299 296
             {
300 297
                 return FALSE;
301 298
             }
@@ -318,8 +315,7 @@  discard block
 block discarded – undo
318 315
                                    ->update($data, $escape);
319 316
                 $this->trigger('after_update', array($data, $result));
320 317
                 return $result;
321
-            }
322
-            else
318
+            } else
323 319
             {
324 320
                 return FALSE;
325 321
             }
@@ -336,8 +332,7 @@  discard block
 block discarded – undo
336 332
                 if(is_array($args[1])){
337 333
                     $data = array_pop($args);
338 334
                 }
339
-            }
340
-            else if(count($args) == 3){
335
+            } else if(count($args) == 3){
341 336
                 if(is_array($args[2])){
342 337
                     $data = array_pop($args);
343 338
                 }
@@ -349,8 +344,7 @@  discard block
 block discarded – undo
349 344
                 $result = $this->_database->from($this->_table)->update($data);
350 345
                 $this->trigger('after_update', array($data, $result));
351 346
                 return $result;
352
-            }
353
-            else
347
+            } else
354 348
             {
355 349
                 return FALSE;
356 350
             }
@@ -377,8 +371,7 @@  discard block
 block discarded – undo
377 371
             if ($this->soft_delete)
378 372
             {
379 373
                 $result = $this->_database->from($this->_table)->update(array( $this->soft_delete_key => TRUE ));
380
-            }
381
-            else
374
+            } else
382 375
             {
383 376
                 $result = $this->_database->from($this->_table)->delete();
384 377
             }
@@ -398,8 +391,7 @@  discard block
 block discarded – undo
398 391
             if ($this->soft_delete)
399 392
             {
400 393
                 $result = $this->_database->from($this->_table)->update(array( $this->soft_delete_key => TRUE ));
401
-            }
402
-            else
394
+            } else
403 395
             {
404 396
                 $result = $this->_database->from($this->_table)->delete();
405 397
             }
@@ -417,8 +409,7 @@  discard block
 block discarded – undo
417 409
             if ($this->soft_delete)
418 410
             {
419 411
                 $result = $this->_database->from($this->_table)->update(array( $this->soft_delete_key => TRUE ));
420
-            }
421
-            else
412
+            } else
422 413
             {
423 414
                 $result = $this->_database->from($this->_table)->delete();
424 415
             }
@@ -463,8 +454,7 @@  discard block
 block discarded – undo
463 454
                 {
464 455
                     $relationship = $value;
465 456
                     $options = array( 'primary_key' => $value . '_id', 'model' => $value . '_model' );
466
-                }
467
-                else
457
+                } else
468 458
                 {
469 459
                     $relationship = $key;
470 460
                     $options = $value;
@@ -474,15 +464,13 @@  discard block
 block discarded – undo
474 464
                 {
475 465
                     if(is_object($this->loaderInstance)){
476 466
                         $this->loaderInstance->model($options['model'], $relationship . '_model');
477
-                    }
478
-                    else{
467
+                    } else{
479 468
                         Loader::model($options['model'], $relationship . '_model');    
480 469
                     }
481 470
                     if (is_object($row))
482 471
                     {
483 472
                         $row->{$relationship} = $this->{$relationship . '_model'}->get($row->{$options['primary_key']});
484
-                    }
485
-                    else
473
+                    } else
486 474
                     {
487 475
                         $row[$relationship] = $this->{$relationship . '_model'}->get($row[$options['primary_key']]);
488 476
                     }
@@ -495,8 +483,7 @@  discard block
 block discarded – undo
495 483
                 {
496 484
                     $relationship = $value;
497 485
                     $options = array( 'primary_key' => $this->_table . '_id', 'model' => $value . '_model' );
498
-                }
499
-                else
486
+                } else
500 487
                 {
501 488
                     $relationship = $key;
502 489
                     $options = $value;
@@ -506,15 +493,13 @@  discard block
 block discarded – undo
506 493
                 {
507 494
                     if(is_object($this->loaderInstance)){
508 495
                         $this->loaderInstance->model($options['model'], $relationship . '_model');
509
-                    }
510
-                    else{
496
+                    } else{
511 497
                         Loader::model($options['model'], $relationship . '_model');    
512 498
                     }
513 499
                     if (is_object($row))
514 500
                     {
515 501
                         $row->{$relationship} = $this->{$relationship . '_model'}->get_many_by($options['primary_key'], $row->{$this->primary_key});
516
-                    }
517
-                    else
502
+                    } else
518 503
                     {
519 504
                         $row[$relationship] = $this->{$relationship . '_model'}->get_many_by($options['primary_key'], $row[$this->primary_key]);
520 505
                     }
@@ -536,8 +521,7 @@  discard block
 block discarded – undo
536 521
             if(count($args) == 2)
537 522
             {
538 523
                 list($key, $value) = $args;
539
-            }
540
-            else
524
+            } else
541 525
             {
542 526
                 $key = $this->primary_key;
543 527
                 $value = $args[0];
@@ -685,8 +669,7 @@  discard block
 block discarded – undo
685 669
             if (is_object($row))
686 670
             {
687 671
                 $row->created_at = date('Y-m-d H:i:s');
688
-            }
689
-            else
672
+            } else
690 673
             {
691 674
                 $row['created_at'] = date('Y-m-d H:i:s');
692 675
             }
@@ -699,8 +682,7 @@  discard block
 block discarded – undo
699 682
             if (is_object($row))
700 683
             {
701 684
                 $row->updated_at = date('Y-m-d H:i:s');
702
-            }
703
-            else
685
+            } else
704 686
             {
705 687
                 $row['updated_at'] = date('Y-m-d H:i:s');
706 688
             }
@@ -727,8 +709,7 @@  discard block
 block discarded – undo
727 709
                 if (is_array($row))
728 710
                 {
729 711
                     $row[$column] = unserialize($row[$column]);
730
-                }
731
-                else
712
+                } else
732 713
                 {
733 714
                     $row->$column = unserialize($row->$column);
734 715
                 }
@@ -748,8 +729,7 @@  discard block
 block discarded – undo
748 729
 					if(isset($row->$attr)){
749 730
 						unset($row->$attr);
750 731
 					}
751
-                }
752
-                else
732
+                } else
753 733
                 {
754 734
 					if(isset($row[$attr])){
755 735
 						unset($row[$attr]);
@@ -828,8 +808,7 @@  discard block
 block discarded – undo
828 808
                 {
829 809
                     $this->_database->orderBy($key, $value);
830 810
                 }
831
-            }
832
-            else
811
+            } else
833 812
             {
834 813
                 $this->_database->orderBy($criteria, $order);
835 814
             }
@@ -887,8 +866,7 @@  discard block
 block discarded – undo
887 866
                 $fv = null;
888 867
                 if(is_object($this->formValidationInstance)){
889 868
                     $fv = $this->formValidationInstance;
890
-                }
891
-                else{
869
+                } else{
892 870
                     Loader::library('FormValidation');
893 871
                     $fv = $this->formvalidation;
894 872
                     $this->setFormValidation($fv);
@@ -901,17 +879,14 @@  discard block
 block discarded – undo
901 879
                     if ($fv->run())
902 880
                     {
903 881
                         return $data;
904
-                    }
905
-                    else
882
+                    } else
906 883
                     {
907 884
                         return FALSE;
908 885
                     }
909
-                }
910
-                else {
886
+                } else {
911 887
                     return $data;
912 888
                 }
913
-            }
914
-            else
889
+            } else
915 890
             {
916 891
                 return $data;
917 892
             }
@@ -930,46 +905,38 @@  discard block
 block discarded – undo
930 905
                     if (is_array($filter))
931 906
                     {
932 907
                         $this->_database->in($field, $filter);
933
-                    }
934
-                    else
908
+                    } else
935 909
                     {
936 910
                         if (is_int($field))
937 911
                         {
938 912
                             $this->_database->where($filter);
939
-                        }
940
-                        else
913
+                        } else
941 914
                         {
942 915
                             $this->_database->where($field, $filter);
943 916
                         }
944 917
                     }
945 918
                 }
946
-            }
947
-            else if (count($params) == 1)
919
+            } else if (count($params) == 1)
948 920
             {
949 921
                 $this->_database->where($params[0]);
950
-            }
951
-        	else if(count($params) == 2)
922
+            } else if(count($params) == 2)
952 923
     		{
953 924
                 if (is_array($params[1]))
954 925
                 {
955 926
                     $this->_database->in($params[0], $params[1]);
956
-                }
957
-                else
927
+                } else
958 928
                 {
959 929
                     $this->_database->where($params[0], $params[1]);
960 930
                 }
961
-    		}
962
-    		else if(count($params) == 3)
931
+    		} else if(count($params) == 3)
963 932
     		{
964 933
     			$this->_database->where($params[0], $params[1], $params[2]);
965
-    		}
966
-            else
934
+    		} else
967 935
             {
968 936
                 if (is_array($params[1]))
969 937
                 {
970 938
                     $this->_database->in($params[0], $params[1]);
971
-                }
972
-                else
939
+                } else
973 940
                 {
974 941
                     $this->_database->where($params[0], $params[1]);
975 942
                 }
Please login to merge, or discard this patch.
core/classes/Loader.php 1 patch
Braces   +18 added lines, -36 removed lines patch added patch discarded remove patch
@@ -148,8 +148,7 @@  discard block
 block discarded – undo
148 148
 					if(isset($path[1])){
149 149
 						$instance = strtolower($path[1]);
150 150
 					}
151
-				}
152
-				else{
151
+				} else{
153 152
 					$instance = strtolower($class);
154 153
 				}
155 154
 			}
@@ -169,8 +168,7 @@  discard block
 block discarded – undo
169 168
 					$searchModuleName = $path[0];
170 169
 					$class = ucfirst($path[1]);
171 170
 				}
172
-			}
173
-			else{
171
+			} else{
174 172
 				$class = ucfirst($class);
175 173
 			}
176 174
 
@@ -181,8 +179,7 @@  discard block
 block discarded – undo
181 179
 			if($moduleModelFilePath){
182 180
 				$logger->info('Found model [' . $class . '] from module [' .$searchModuleName. '], the file path is [' .$moduleModelFilePath. '] we will used it');
183 181
 				$classFilePath = $moduleModelFilePath;
184
-			}
185
-			else{
182
+			} else{
186 183
 				$logger->info('Cannot find model [' . $class . '] from modules using the default location');
187 184
 			}
188 185
 			$logger->info('The model file path to be loaded is [' . $classFilePath . ']');
@@ -194,12 +191,10 @@  discard block
 block discarded – undo
194 191
 					$obj->{$instance} = $c;
195 192
 					static::$loaded[$instance] = $class;
196 193
 					$logger->info('Model [' . $class . '] --> ' . $classFilePath . ' loaded successfully.');
197
-				}
198
-				else{
194
+				} else{
199 195
 					show_error('The file '.$classFilePath.' exists but does not contain the class ['. $class . ']');
200 196
 				}
201
-			}
202
-			else{
197
+			} else{
203 198
 				show_error('Unable to find the model [' . $class . ']');
204 199
 			}
205 200
 		}
@@ -227,8 +222,7 @@  discard block
 block discarded – undo
227 222
 					if(isset($path[1])){
228 223
 						$instance = strtolower($path[1]);
229 224
 					}
230
-				}
231
-				else{
225
+				} else{
232 226
 					$instance = strtolower($class);
233 227
 				}
234 228
 			}
@@ -254,8 +248,7 @@  discard block
 block discarded – undo
254 248
 				$libraryFilePath = CORE_LIBRARY_PATH . $file;
255 249
 				$class = ucfirst($class);
256 250
 				$logger->info('This library is a system library');
257
-			}
258
-			else{
251
+			} else{
259 252
 				$logger->info('This library is not a system library');	
260 253
 				//first check if this library is in the module
261 254
 				$logger->debug('Checking library [' . $class . '] from module list ...');
@@ -267,8 +260,7 @@  discard block
 block discarded – undo
267 260
 						$searchModuleName = $path[0];
268 261
 						$class = ucfirst($path[1]);
269 262
 					}
270
-				}
271
-				else{
263
+				} else{
272 264
 					$class = ucfirst($class);
273 265
 				}
274 266
 				if(! $searchModuleName && !empty($obj->moduleName)){
@@ -278,8 +270,7 @@  discard block
 block discarded – undo
278 270
 				if($moduleLibraryPath){
279 271
 					$logger->info('Found library [' . $class . '] from module [' .$searchModuleName. '], the file path is [' .$moduleLibraryPath. '] we will used it');
280 272
 					$libraryFilePath = $moduleLibraryPath;
281
-				}
282
-				else{
273
+				} else{
283 274
 					$logger->info('Cannot find library [' . $class . '] from modules using the default location');
284 275
 				}
285 276
 			}
@@ -303,12 +294,10 @@  discard block
 block discarded – undo
303 294
 					$obj->{$instance} = $c;
304 295
 					static::$loaded[$instance] = $class;
305 296
 					$logger->info('Library [' . $class . '] --> ' . $libraryFilePath . ' loaded successfully.');
306
-				}
307
-				else{
297
+				} else{
308 298
 					show_error('The file '.$libraryFilePath.' exists but does not contain the class '.$class);
309 299
 				}
310
-			}
311
-			else{
300
+			} else{
312 301
 				show_error('Unable to find library class [' . $class . ']');
313 302
 			}
314 303
 		}
@@ -352,8 +341,7 @@  discard block
 block discarded – undo
352 341
 			if($moduleFunctionPath){
353 342
 				$logger->info('Found helper [' . $function . '] from module [' .$searchModuleName. '], the file path is [' .$moduleFunctionPath. '] we will used it');
354 343
 				$functionFilePath = $moduleFunctionPath;
355
-			}
356
-			else{
344
+			} else{
357 345
 				$logger->info('Cannot find helper [' . $function . '] from modules using the default location');
358 346
 			}
359 347
 			if(! $functionFilePath){
@@ -372,8 +360,7 @@  discard block
 block discarded – undo
372 360
 				require_once $functionFilePath;
373 361
 				static::$loaded['function_' . $function] = $functionFilePath;
374 362
 				$logger->info('Helper [' . $function . '] --> ' . $functionFilePath . ' loaded successfully.');
375
-			}
376
-			else{
363
+			} else{
377 364
 				show_error('Unable to find helper file [' . $file . ']');
378 365
 			}
379 366
 		}
@@ -417,8 +404,7 @@  discard block
 block discarded – undo
417 404
 			if($moduleConfigPath){
418 405
 				$logger->info('Found config [' . $filename . '] from module [' .$searchModuleName. '], the file path is [' .$moduleConfigPath. '] we will used it');
419 406
 				$configFilePath = $moduleConfigPath;
420
-			}
421
-			else{
407
+			} else{
422 408
 				$logger->info('Cannot find config [' . $filename . '] from modules using the default location');
423 409
 			}
424 410
 			$logger->info('The config file path to be loaded is [' . $configFilePath . ']');
@@ -426,12 +412,10 @@  discard block
 block discarded – undo
426 412
 				require_once $configFilePath;
427 413
 				if(! empty($config) && is_array($config)){
428 414
 					Config::setAll($config);
429
-				}
430
-				else{
415
+				} else{
431 416
 					show_error('No configuration found in ['. $configFilePath . ']');
432 417
 				}
433
-			}
434
-			else{
418
+			} else{
435 419
 				show_error('Unable to find config file ['. $configFilePath . ']');
436 420
 			}
437 421
 			static::$loaded['config_' . $filename] = $configFilePath;
@@ -489,8 +473,7 @@  discard block
 block discarded – undo
489 473
 			if($moduleLanguagePath){
490 474
 				$logger->info('Found language [' . $language . '] from module [' .$searchModuleName. '], the file path is [' .$moduleLanguagePath. '] we will used it');
491 475
 				$languageFilePath = $moduleLanguagePath;
492
-			}
493
-			else{
476
+			} else{
494 477
 				$logger->info('Cannot find language [' . $language . '] from modules using the default location');
495 478
 			}
496 479
 			if(! $languageFilePath){
@@ -517,8 +500,7 @@  discard block
 block discarded – undo
517 500
 				}
518 501
 				static::$loaded['lang_' . $language] = $languageFilePath;
519 502
 				$logger->info('Language [' . $language . '] --> ' . $languageFilePath . ' loaded successfully.');
520
-			}
521
-			else{
503
+			} else{
522 504
 				show_error('Unable to find language file [' . $file . ']');
523 505
 			}
524 506
 		}
Please login to merge, or discard this patch.
core/classes/cache/FileCache.php 1 patch
Braces   +12 added lines, -24 removed lines patch added patch discarded remove patch
@@ -48,8 +48,7 @@  discard block
 block discarded – undo
48 48
 	         */
49 49
 	        if(is_object($logger)){
50 50
 	          $this->logger = $logger;
51
-	        }
52
-	        else{
51
+	        } else{
53 52
 	            $this->logger =& class_loader('Log', 'classes');
54 53
 	            $this->logger->setLogger('Library::FileCache');
55 54
 	        }
@@ -95,8 +94,7 @@  discard block
 block discarded – undo
95 94
 		        // Unlinking when the file was expired
96 95
 		        unlink($filePath);
97 96
 		        return false;
98
-		     }
99
-		     else{
97
+		     } else{
100 98
 		     	$this->logger->info('The cache not yet expire, now return the cache data for key ['. $key .'], the cache will expire at [' . date('Y-m-d H:i:s', $data['expire']) . ']');
101 99
 		     	return $data['data'];
102 100
 		     }
@@ -134,8 +132,7 @@  discard block
 block discarded – undo
134 132
 		    	$this->logger->error('Can not write cache data into file [' .$filePath. '] for the key ['. $key .'], return false');
135 133
 		    	fclose($handle);
136 134
 		    	return false;
137
-		    }
138
-		    else{
135
+		    } else{
139 136
 		    	$this->logger->info('Cache data saved into file [' .$filePath. '] for the key ['. $key .']');
140 137
 		    	fclose($handle);
141 138
 				chmod($filePath, 0640);
@@ -157,8 +154,7 @@  discard block
 block discarded – undo
157 154
 			if(! file_exists($filePath)){
158 155
 				$this->logger->info('This cache file does not exists skipping');
159 156
 				return false;
160
-			}
161
-			else{
157
+			} else{
162 158
 				$this->logger->info('Found cache file [' .$filePath. '] remove it');
163 159
 	      		@unlink($filePath);
164 160
 				return true;
@@ -180,16 +176,14 @@  discard block
 block discarded – undo
180 176
 			if(! file_exists($filePath)){
181 177
 				$this->logger->info('This cache file does not exists skipping');
182 178
 				return false;
183
-			}
184
-			else{
179
+			} else{
185 180
 				$this->logger->info('Found cache file [' .$filePath. '] check the validity');
186 181
 	      		$data = file_get_contents($filePath);
187 182
 				$data = @unserialize($this->compressCacheData ? gzinflate($data) : $data);
188 183
 				if(! $data){
189 184
 					$this->logger->warning('Can not unserialize the cache data for file [' . $filePath . ']');
190 185
 					return false;
191
-				}
192
-				else{
186
+				} else{
193 187
 					$this->logger->info('This cache data is OK check for expire');
194 188
 					if(isset($data['expire']) && $data['expire'] > time()){
195 189
 						$this->logger->info('This cache not yet expired return cache informations');
@@ -199,8 +193,7 @@  discard block
 block discarded – undo
199 193
 							'ttl' => $data['ttl']
200 194
 							);
201 195
 						return $info;
202
-					}
203
-					else{
196
+					} else{
204 197
 						$this->logger->info('This cache already expired return false');
205 198
 						return false;
206 199
 					}
@@ -217,8 +210,7 @@  discard block
 block discarded – undo
217 210
 			$list = glob(CACHE_PATH . '*.cache');
218 211
 			if(! $list){
219 212
 				$this->logger->info('No cache files were found skipping');
220
-			}
221
-			else{
213
+			} else{
222 214
 				$this->logger->info('Found [' . count($list) . '] cache files to remove if expired');
223 215
 				foreach ($list as $file) {
224 216
 					$this->logger->debug('Processing the cache file [' . $file . ']');
@@ -226,12 +218,10 @@  discard block
 block discarded – undo
226 218
 		      		$data = @unserialize($this->compressCacheData ? gzinflate($data) : $data);
227 219
 		      		if(! $data){
228 220
 		      			$this->logger->warning('Can not unserialize the cache data for file [' . $file . ']');
229
-		      		}
230
-		      		else if(time() > $data['expire']){
221
+		      		} else if(time() > $data['expire']){
231 222
 		      			$this->logger->info('The cache data for file [' . $file . '] already expired remove it');
232 223
 		      			@unlink($file);
233
-		      		}
234
-		      		else{
224
+		      		} else{
235 225
 		      			$this->logger->info('The cache data for file [' . $file . '] not yet expired skip it');
236 226
 		      		}
237 227
 				}
@@ -246,8 +236,7 @@  discard block
 block discarded – undo
246 236
 			$list = glob(CACHE_PATH . '*.cache');
247 237
 			if(! $list){
248 238
 				$this->logger->info('No cache files were found skipping');
249
-			}
250
-			else{
239
+			} else{
251 240
 				$this->logger->info('Found [' . count($list) . '] cache files to remove');
252 241
 				foreach ($list as $file) {
253 242
 					$this->logger->debug('Processing the cache file [' . $file . ']');
@@ -274,8 +263,7 @@  discard block
 block discarded – undo
274 263
 				
275 264
 				$this->logger->warning('The zlib extension is not loaded set cache compress data to FALSE');
276 265
 				$this->compressCacheData = false;
277
-			}
278
-			else{
266
+			} else{
279 267
 				$this->compressCacheData = $status;
280 268
 			}
281 269
 			return $this;
Please login to merge, or discard this patch.
core/classes/cache/ApcCache.php 1 patch
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -43,8 +43,7 @@  discard block
 block discarded – undo
43 43
 	         */
44 44
 	        if(is_object($logger)){
45 45
 	          $this->logger = $logger;
46
-	        }
47
-	        else{
46
+	        } else{
48 47
 	            $this->logger =& class_loader('Log', 'classes');
49 48
 	            $this->logger->setLogger('Library::ApcCache');
50 49
 	        }
@@ -62,8 +61,7 @@  discard block
 block discarded – undo
62 61
 			if($success === false){
63 62
 				$this->logger->info('No cache found for the key ['. $key .'], return false');
64 63
 				return false;
65
-			}
66
-			else{
64
+			} else{
67 65
 				$cacheInfo = $this->_getCacheInfo($key);
68 66
 				$expire = time();
69 67
 				if($cacheInfo){
@@ -89,8 +87,7 @@  discard block
 block discarded – undo
89 87
 			if($result === false){
90 88
 		    	$this->logger->error('Can not write cache data for the key ['. $key .'], return false');
91 89
 		    	return false;
92
-		    }
93
-		    else{
90
+		    } else{
94 91
 		    	$this->logger->info('Cache data saved for the key ['. $key .']');
95 92
 		    	return true;
96 93
 		    }
@@ -109,8 +106,7 @@  discard block
 block discarded – undo
109 106
 			if($cacheInfo === false){
110 107
 				$this->logger->info('This cache data does not exists skipping');
111 108
 				return false;
112
-			}
113
-			else{
109
+			} else{
114 110
 				$this->logger->info('Found cache data for the key [' .$key. '] remove it');
115 111
 	      		return apc_delete($key);
116 112
 			}
@@ -135,8 +131,7 @@  discard block
 block discarded – undo
135 131
 							'ttl' => $cacheInfos['ttl']
136 132
 							);
137 133
 				return $data;
138
-			}
139
-			else{
134
+			} else{
140 135
 				$this->logger->info('This cache does not exists skipping');
141 136
 				return false;
142 137
 			}
@@ -160,8 +155,7 @@  discard block
 block discarded – undo
160 155
 			if(empty($cacheInfos['cache_list'])){
161 156
 				$this->logger->info('No cache data were found skipping');
162 157
 				return false;
163
-			}
164
-			else{
158
+			} else{
165 159
 				$this->logger->info('Found [' . count($cacheInfos) . '] cache data to remove');
166 160
 				return apc_clear_cache('user');
167 161
 			}
Please login to merge, or discard this patch.
core/classes/Database.php 1 patch
Braces   +42 added lines, -84 removed lines patch added patch discarded remove patch
@@ -188,8 +188,7 @@  discard block
 block discarded – undo
188 188
          */
189 189
         if(is_object($logger)){
190 190
           $this->logger = $logger;
191
-        }
192
-        else{
191
+        } else{
193 192
             $this->logger =& class_loader('Log', 'classes');
194 193
             $this->logger->setLogger('Library::Database');
195 194
         }
@@ -236,11 +235,9 @@  discard block
 block discarded – undo
236 235
                 $dsn = $config['driver'] . ':host=' . $config['hostname'] . ';'
237 236
                 . (($config['port']) != '' ? 'port=' . $config['port'] . ';' : '')
238 237
                 . 'dbname=' . $config['database'];
239
-            }
240
-            else if ($config['driver'] == 'sqlite'){
238
+            } else if ($config['driver'] == 'sqlite'){
241 239
               $dsn = 'sqlite:' . $config['database'];
242
-            }
243
-            else if($config['driver'] == 'oracle'){
240
+            } else if($config['driver'] == 'oracle'){
244 241
               $dsn = 'oci:dbname=' . $config['host'] . '/' . $config['database'];
245 242
             }
246 243
             
@@ -249,14 +246,12 @@  discard block
 block discarded – undo
249 246
             $this->pdo->exec("SET CHARACTER SET '" . $config['charset'] . "'");
250 247
             $this->pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ);
251 248
             return true;
252
-          }
253
-          catch (PDOException $e){
249
+          } catch (PDOException $e){
254 250
             $this->logger->fatal($e->getMessage());
255 251
             show_error('Cannot connect to Database.');
256 252
             return false;
257 253
           }
258
-      }
259
-      else{
254
+      } else{
260 255
         show_error('Database configuration is not set.');
261 256
         return false;
262 257
       }
@@ -274,8 +269,7 @@  discard block
 block discarded – undo
274 269
           $froms .= $this->prefix . $key . ', ';
275 270
         }
276 271
         $this->from = rtrim($froms, ', ');
277
-      }
278
-      else{
272
+      } else{
279 273
         $this->from = $this->prefix . $table;
280 274
       }
281 275
       return $this;
@@ -381,8 +375,7 @@  discard block
 block discarded – undo
381 375
       }
382 376
       if (is_null($this->join)){
383 377
         $this->join = ' ' . $type . 'JOIN' . ' ' . $table . ' ON ' . $on;
384
-      }
385
-      else{
378
+      } else{
386 379
         $this->join = $this->join . ' ' . $type . 'JOIN' . ' ' . $table . ' ON ' . $on;
387 380
       }
388 381
       return $this;
@@ -453,12 +446,10 @@  discard block
 block discarded – undo
453 446
         foreach($field as $f){
454 447
         	$this->whereIsNull($f, $andOr);
455 448
         }
456
-      }
457
-      else{
449
+      } else{
458 450
         if (! $this->where){
459 451
           $this->where = $field.' IS NULL ';
460
-        }
461
-        else{
452
+        } else{
462 453
             $this->where = $this->where . ' '.$andOr.' ' . $field.' IS NULL ';
463 454
           }
464 455
       }
@@ -476,12 +467,10 @@  discard block
 block discarded – undo
476 467
         foreach($field as $f){
477 468
           $this->whereIsNotNull($f, $andOr);
478 469
         }
479
-      }
480
-      else{
470
+      } else{
481 471
         if (! $this->where){
482 472
           $this->where = $field.' IS NOT NULL ';
483
-        }
484
-        else{
473
+        } else{
485 474
             $this->where = $this->where . ' '.$andOr.' ' . $field.' IS NOT NULL ';
486 475
           }
487 476
       }
@@ -508,8 +497,7 @@  discard block
 block discarded – undo
508 497
           $_where[] = $type . $column . '=' . ($escape ? $this->escape($data) : $data);
509 498
         }
510 499
         $where = implode(' '.$andOr.' ', $_where);
511
-      }
512
-      else{
500
+      } else{
513 501
         if(is_array($op)){
514 502
           $x = explode('?', $where);
515 503
           $w = '';
@@ -522,14 +510,12 @@  discard block
 block discarded – undo
522 510
             }
523 511
           }
524 512
           $where = $w;
525
-        }
526
-        else if (! in_array((string)$op, $this->operatorList)){
513
+        } else if (! in_array((string)$op, $this->operatorList)){
527 514
           if(is_null($op)){
528 515
             $op = '';
529 516
           }
530 517
         	$where = $type . $where . ' = ' . ($escape ? $this->escape($op) : $op);
531
-        }
532
-        else{
518
+        } else{
533 519
           if(is_null($val)){
534 520
             $val = '';
535 521
           }
@@ -538,12 +524,10 @@  discard block
 block discarded – undo
538 524
       }
539 525
       if (is_null($this->where)){
540 526
         $this->where = $where;
541
-      }
542
-      else{
527
+      } else{
543 528
         if(substr($this->where, -1) == '('){
544 529
           $this->where = $this->where . ' ' . $where;
545
-        }
546
-        else{
530
+        } else{
547 531
           $this->where = $this->where . ' '.$andOr.' ' . $where;
548 532
         }
549 533
       }
@@ -587,12 +571,10 @@  discard block
 block discarded – undo
587 571
     public function groupStart($type = '', $andOr = ' AND'){
588 572
       if (is_null($this->where)){
589 573
         $this->where = $type . ' (';
590
-      }
591
-      else{
574
+      } else{
592 575
           if(substr($this->where, -1) == '('){
593 576
             $this->where .= $type . ' (';
594
-          }
595
-          else{
577
+          } else{
596 578
           	$this->where .= $andOr . ' ' . $type . ' (';
597 579
           }
598 580
       }
@@ -656,12 +638,10 @@  discard block
 block discarded – undo
656 638
         $keys = implode(', ', $_keys);
657 639
         if (is_null($this->where)){
658 640
           $this->where = $field . ' ' . $type . 'IN (' . $keys . ')';
659
-        }
660
-        else{
641
+        } else{
661 642
           if(substr($this->where, -1) == '('){
662 643
             $this->where = $this->where . ' ' . $field . ' '.$type.'IN (' . $keys . ')';
663
-          }
664
-          else{
644
+          } else{
665 645
             $this->where = $this->where . ' ' . $andOr . ' ' . $field . ' '.$type.'IN (' . $keys . ')';
666 646
           }
667 647
         }
@@ -715,12 +695,10 @@  discard block
 block discarded – undo
715 695
       }
716 696
       if (is_null($this->where)){
717 697
       	$this->where = $field . ' ' . $type . 'BETWEEN ' . ($escape ? $this->escape($value1) : $value1) . ' AND ' . ($escape ? $this->escape($value2) : $value2);
718
-      }
719
-      else{
698
+      } else{
720 699
         if(substr($this->where, -1) == '('){
721 700
           $this->where = $this->where . ' ' . $field . ' ' . $type . 'BETWEEN ' . ($escape ? $this->escape($value1) : $value1) . ' AND ' . ($escape ? $this->escape($value2) : $value2);
722
-        }
723
-        else{
701
+        } else{
724 702
           $this->where = $this->where . ' ' . $andOr . ' ' . $field . ' ' . $type . 'BETWEEN ' . ($escape ? $this->escape($value1) : $value1) . ' AND ' . ($escape ? $this->escape($value2) : $value2);
725 703
         }
726 704
       }
@@ -770,12 +748,10 @@  discard block
 block discarded – undo
770 748
       $like = $escape ? $this->escape($data) : $data;
771 749
       if (is_null($this->where)){
772 750
         $this->where = $field . ' ' . $type . 'LIKE ' . $like;
773
-      }
774
-      else{
751
+      } else{
775 752
         if(substr($this->where, -1) == '('){
776 753
           $this->where = $this->where . ' ' . $field . ' ' . $type . 'LIKE ' . $like;
777
-        }
778
-        else{
754
+        } else{
779 755
           $this->where = $this->where . ' '.$andOr.' ' . $field . ' ' . $type . 'LIKE ' . $like;
780 756
         }
781 757
       }
@@ -822,8 +798,7 @@  discard block
 block discarded – undo
822 798
       }
823 799
       if (! is_null($limitEnd)){
824 800
         $this->limit = $limit . ', ' . $limitEnd;
825
-      }
826
-      else{
801
+      } else{
827 802
         $this->limit = $limit;
828 803
       }
829 804
       return $this;
@@ -838,12 +813,10 @@  discard block
 block discarded – undo
838 813
     public function orderBy($orderBy, $orderDir = ' ASC'){
839 814
       if (! is_null($orderDir)){
840 815
         $this->orderBy = ! $this->orderBy ? ($orderBy . ' ' . strtoupper($orderDir)) : $this->orderBy . ', ' . $orderBy . ' ' . strtoupper($orderDir);
841
-      }
842
-      else{
816
+      } else{
843 817
         if(stristr($orderBy, ' ') || $orderBy == 'rand()'){
844 818
           $this->orderBy = ! $this->orderBy ? $orderBy : $this->orderBy . ', ' . $orderBy;
845
-        }
846
-        else{
819
+        } else{
847 820
           $this->orderBy = ! $this->orderBy ? ($orderBy . ' ASC') : $this->orderBy . ', ' . ($orderBy . ' ASC');
848 821
         }
849 822
       }
@@ -858,8 +831,7 @@  discard block
 block discarded – undo
858 831
     public function groupBy($field){
859 832
       if(is_array($field)){
860 833
         $this->groupBy = implode(', ', $field);
861
-      }
862
-      else{
834
+      } else{
863 835
         $this->groupBy = $field;
864 836
       }
865 837
       return $this;
@@ -886,14 +858,12 @@  discard block
 block discarded – undo
886 858
   	      }
887 859
       	}
888 860
         $this->having = $w;
889
-      }
890
-      else if (! in_array($op, $this->operatorList)){
861
+      } else if (! in_array($op, $this->operatorList)){
891 862
         if(is_null($op)){
892 863
           $op = '';
893 864
         }
894 865
         $this->having = $field . ' > ' . ($escape ? $this->escape($op) : $op);
895
-      }
896
-      else{
866
+      } else{
897 867
         if(is_null($val)){
898 868
           $val = '';
899 869
         }
@@ -938,8 +908,7 @@  discard block
 block discarded – undo
938 908
       $query = $this->getAll(true);
939 909
       if($returnSQLQueryOrResultType === true){
940 910
         return $query;
941
-      }
942
-      else{
911
+      } else{
943 912
         return $this->query( $query, false, (($returnSQLQueryOrResultType == 'array') ? true : false) );
944 913
       }
945 914
     }
@@ -978,8 +947,7 @@  discard block
 block discarded – undo
978 947
 	  
979 948
 	  if($returnSQLQueryOrResultType === true){
980 949
     	return $query;
981
-      }
982
-      else{
950
+      } else{
983 951
     	return $this->query($query, true, (($returnSQLQueryOrResultType == 'array') ? true : false) );
984 952
       }
985 953
     }
@@ -997,8 +965,7 @@  discard block
 block discarded – undo
997 965
         $columns = array_keys($this->getData());
998 966
         $column = implode(',', $columns);
999 967
         $val = implode(', ', $this->getData());
1000
-      }
1001
-      else{
968
+      } else{
1002 969
         $columns = array_keys($data);
1003 970
         $column = implode(',', $columns);
1004 971
         $val = implode(', ', ($escape ? array_map(array($this, 'escape'), $data) : $data));
@@ -1013,8 +980,7 @@  discard block
 block discarded – undo
1013 980
         }
1014 981
         $this->insertId = $this->pdo->lastInsertId();
1015 982
         return $this->insertId();
1016
-      }
1017
-      else{
983
+      } else{
1018 984
 		  return false;
1019 985
       }
1020 986
     }
@@ -1032,8 +998,7 @@  discard block
 block discarded – undo
1032 998
         foreach ($this->getData() as $column => $val){
1033 999
           $values[] = $column . ' = ' . $val;
1034 1000
         }
1035
-      }
1036
-      else{
1001
+      } else{
1037 1002
         foreach ($data as $column => $val){
1038 1003
           $values[] = $column . '=' . ($escape ? $this->escape($val) : $val);
1039 1004
         }
@@ -1127,14 +1092,12 @@  discard block
 block discarded – undo
1127 1092
         $cacheKey = md5($query . $all . $array);
1128 1093
         if(is_object($this->cacheInstance)){
1129 1094
           $cacheInstance = $this->cacheInstance;
1130
-        }
1131
-        else{
1095
+        } else{
1132 1096
           $obj = & get_instance();
1133 1097
           $cacheInstance = $obj->cache;  
1134 1098
         }
1135 1099
         $cacheContent = $cacheInstance->get($cacheKey);        
1136
-      }
1137
-      else{
1100
+      } else{
1138 1101
 		  $this->logger->info('The cache is not enabled for this query or is not the SELECT query, get the result directly from real database');
1139 1102
       }
1140 1103
 
@@ -1148,8 +1111,7 @@  discard block
 block discarded – undo
1148 1111
         $bench = null;
1149 1112
         if(is_object($this->benchmarkInstance)){
1150 1113
           $bench = $this->benchmarkInstance;
1151
-        }
1152
-        else{
1114
+        } else{
1153 1115
           $obj = & get_instance();
1154 1116
           $bench = $obj->benchmark;  
1155 1117
         }
@@ -1169,8 +1131,7 @@  discard block
 block discarded – undo
1169 1131
 		    	//if need return all result like list of record
1170 1132
             if ($all){
1171 1133
     				$this->result = ($array == false) ? $sqlQuery->fetchAll(PDO::FETCH_OBJ) : $sqlQuery->fetchAll(PDO::FETCH_ASSOC);
1172
-    		    }
1173
-            else{
1134
+    		    } else{
1174 1135
 				        $this->result = ($array == false) ? $sqlQuery->fetch(PDO::FETCH_OBJ) : $sqlQuery->fetch(PDO::FETCH_ASSOC);
1175 1136
             }
1176 1137
           }
@@ -1178,15 +1139,13 @@  discard block
 block discarded – undo
1178 1139
             $this->logger->info('Save the result for query [' .$this->query. '] into cache for future use');
1179 1140
             $cacheInstance->set($cacheKey, $this->result, $cacheExpire);
1180 1141
           }
1181
-        }
1182
-        else{
1142
+        } else{
1183 1143
           $error = $this->pdo->errorInfo();
1184 1144
           $this->error = $error[2];
1185 1145
           $this->logger->fatal('The database query execution got error: ' . stringfy_vars($error));
1186 1146
           $this->error();
1187 1147
         }
1188
-      }
1189
-      else if ((! $cacheContent && !$sqlSELECTQuery) || ($cacheContent && !$sqlSELECTQuery)){
1148
+      } else if ((! $cacheContent && !$sqlSELECTQuery) || ($cacheContent && !$sqlSELECTQuery)){
1190 1149
     		$queryStr = $this->pdo->query($this->query);
1191 1150
     		if($queryStr){
1192 1151
     			$this->result = $queryStr->rowCount() >= 0; //to test the result for the query like UPDATE, INSERT, DELETE
@@ -1198,8 +1157,7 @@  discard block
 block discarded – undo
1198 1157
           $this->logger->fatal('The database query execution got error: ' . stringfy_vars($error));
1199 1158
           $this->error();
1200 1159
         }
1201
-      }
1202
-      else{
1160
+      } else{
1203 1161
         $this->logger->info('The result for query [' .$this->query. '] already cached use it');
1204 1162
         $this->result = $cacheContent;
1205 1163
 	     	$this->numRows = count($this->result);
Please login to merge, or discard this patch.