Passed
Push — 1.0.0-dev ( 9c9ab7...066288 )
by nguereza
02:38
created
core/classes/cache/FileCache.php 1 patch
Braces   +9 added lines, -18 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
 		     }
@@ -133,8 +131,7 @@  discard block
 block discarded – undo
133 131
 		    	$this->logger->error('Can not write cache data into file [' .$filePath. '] for the key ['. $key .'], return false');
134 132
 		    	fclose($handle);
135 133
 		    	return false;
136
-		    }
137
-		    else{
134
+		    } else{
138 135
 		    	$this->logger->info('Cache data saved into file [' .$filePath. '] for the key ['. $key .']');
139 136
 		    	fclose($handle);
140 137
 				chmod($filePath, 0640);
@@ -156,8 +153,7 @@  discard block
 block discarded – undo
156 153
 			if(! file_exists($filePath)){
157 154
 				$this->logger->info('This cache file does not exists skipping');
158 155
 				return false;
159
-			}
160
-			else{
156
+			} else{
161 157
 				$this->logger->info('Found cache file [' .$filePath. '] remove it');
162 158
 	      		unlink($filePath);
163 159
 				return true;
@@ -210,8 +206,7 @@  discard block
 block discarded – undo
210 206
 			$list = glob(CACHE_PATH . '*.cache');
211 207
 			if(! $list){
212 208
 				$this->logger->info('No cache files were found skipping');
213
-			}
214
-			else{
209
+			} else{
215 210
 				$this->logger->info('Found [' . count($list) . '] cache files to remove if expired');
216 211
 				foreach ($list as $file) {
217 212
 					$this->logger->debug('Processing the cache file [' . $file . ']');
@@ -219,12 +214,10 @@  discard block
 block discarded – undo
219 214
 		      		$data = @unserialize($this->compressCacheData ? gzinflate($data) : $data);
220 215
 		      		if(! $data){
221 216
 		      			$this->logger->warning('Can not unserialize the cache data for file [' . $file . ']');
222
-		      		}
223
-		      		else if(time() > $data['expire']){
217
+		      		} else if(time() > $data['expire']){
224 218
 		      			$this->logger->info('The cache data for file [' . $file . '] already expired remove it');
225 219
 		      			unlink($file);
226
-		      		}
227
-		      		else{
220
+		      		} else{
228 221
 		      			$this->logger->info('The cache data for file [' . $file . '] not yet expired skip it');
229 222
 		      		}
230 223
 				}
@@ -239,8 +232,7 @@  discard block
 block discarded – undo
239 232
 			$list = glob(CACHE_PATH . '*.cache');
240 233
 			if(! $list){
241 234
 				$this->logger->info('No cache files were found skipping');
242
-			}
243
-			else{
235
+			} else{
244 236
 				$this->logger->info('Found [' . count($list) . '] cache files to remove');
245 237
 				foreach ($list as $file) {
246 238
 					$this->logger->debug('Processing the cache file [' . $file . ']');
@@ -267,8 +259,7 @@  discard block
 block discarded – undo
267 259
 				
268 260
 				$this->logger->warning('The zlib extension is not loaded set cache compress data to FALSE');
269 261
 				$this->compressCacheData = false;
270
-			}
271
-			else{
262
+			} else{
272 263
 				$this->compressCacheData = $status;
273 264
 			}
274 265
 			return $this;
Please login to merge, or discard this patch.
core/classes/Router.php 1 patch
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -266,8 +266,7 @@  discard block
 block discarded – undo
266 266
 	    	//if the application is running in CLI mode use the first argument
267 267
 			else if(IS_CLI && isset($_SERVER['argv'][1])){
268 268
 				$routeUri = $_SERVER['argv'][1];
269
-			}
270
-			else if(isset($_SERVER['REQUEST_URI'])){
269
+			} else if(isset($_SERVER['REQUEST_URI'])){
271 270
 				$routeUri = $_SERVER['REQUEST_URI'];
272 271
 			}
273 272
 			$this->logger->debug('Check if URL suffix is enabled in the configuration');
@@ -363,15 +362,13 @@  discard block
 block discarded – undo
363 362
 				if(! class_exists($controller, false)){
364 363
 					$e404 = true;
365 364
 					$this->logger->warning('The controller file [' .$classFilePath. '] exists but does not contain the class [' . $controller . ']');
366
-				}
367
-				else{
365
+				} else{
368 366
 					$controllerInstance = new $controller();
369 367
 					$controllerMethod = $this->getMethod();
370 368
 					if(! method_exists($controllerInstance, $controllerMethod)){
371 369
 						$e404 = true;
372 370
 						$this->logger->warning('The controller [' . $controller . '] exist but does not contain the method [' . $controllerMethod . ']');
373
-					}
374
-					else{
371
+					} else{
375 372
 						$this->logger->info('Routing data is set correctly now GO!');
376 373
 						call_user_func_array(array($controllerInstance, $controllerMethod), $this->args);
377 374
 						//render the final page to user
@@ -379,8 +376,7 @@  discard block
 block discarded – undo
379 376
 						get_instance()->response->renderFinalPage();
380 377
 					}
381 378
 				}
382
-			}
383
-			else{
379
+			} else{
384 380
 				$this->logger->info('The controller file path [' . $classFilePath . '] does not exist');
385 381
 				$e404 = true;
386 382
 			}
@@ -486,8 +482,7 @@  discard block
 block discarded – undo
486 482
 						$this->logger->info('The current request use the module [' . $moduleControllerMethod[0] . ']');
487 483
 						$this->module = $moduleControllerMethod[0];
488 484
 						$moduleControllerMethod = explode('@', $moduleControllerMethod[1]);
489
-					}
490
-					else{
485
+					} else{
491 486
 						$this->logger->info('The current request does not use the module');
492 487
 						$moduleControllerMethod = explode('@', $this->callback[$index]);
493 488
 					}
@@ -543,8 +538,7 @@  discard block
 block discarded – undo
543 538
 					}
544 539
 					//args
545 540
 					$this->args = $segment;
546
-				}
547
-				else{
541
+				} else{
548 542
 					$this->logger->info('The application contains a loaded module will check if the current request is found in the module list');
549 543
 					if(in_array($segment[0], $modules)){
550 544
 						$this->logger->info('Found, the current request use the module [' . $segment[0] . ']');
@@ -558,8 +552,7 @@  discard block
 block discarded – undo
558 552
 							if(! $path){
559 553
 								$this->logger->info('The controller [' . $this->controller . '] not found in the module, may be will use the module [' . $this->module . '] as controller');
560 554
 								$this->controller = $this->module;
561
-							}
562
-							else{
555
+							} else{
563 556
 								$this->controllerPath = $path;
564 557
 								array_shift($segment);
565 558
 							}
@@ -571,8 +564,7 @@  discard block
 block discarded – undo
571 564
 						}
572 565
 						//the remaining is for args
573 566
 						$this->args = $segment;
574
-					}
575
-					else{
567
+					} else{
576 568
 						$this->logger->info('The current request information is not found in the module list');
577 569
 						//controller
578 570
 						if(isset($segment[0])){
@@ -615,8 +607,7 @@  discard block
 block discarded – undo
615 607
 	    protected function setLoggerFromParamOrCreateNewInstance(Log $logger = null){
616 608
 	      if ($logger !== null){
617 609
 	        $this->logger = $logger;
618
-	      }
619
-	      else{
610
+	      } else{
620 611
 	          $this->logger =& class_loader('Log', 'classes');
621 612
 	          $this->logger->setLogger('Library::Router');
622 613
 	      }
Please login to merge, or discard this patch.
core/classes/Security.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -60,8 +60,7 @@  discard block
 block discarded – undo
60 60
 			if(Session::exists($key) && Session::exists($keyExpire) && Session::get($keyExpire) > $currentTime){
61 61
 				$logger->info('The CSRF token not yet expire just return it');
62 62
 				return Session::get($key);
63
-			}
64
-			else{
63
+			} else{
65 64
 				$newTime = $currentTime + $expire;
66 65
 				$token = sha1(uniqid()) . sha1(uniqid());
67 66
 				$logger->info('The CSRF informations are listed below: key [' .$key. '], key expire [' .$keyExpire. '], expire time [' .$expire. '], token [' .$token. ']');
@@ -123,8 +122,7 @@  discard block
 block discarded – undo
123 122
 						$logger->info('IP address ' . $ip . ' allowed using the wildcard "*" or the full IP');
124 123
 						//wildcard to access all ip address
125 124
 						return;
126
-					}
127
-					else{
125
+					} else{
128 126
 						// go through all whitelisted ips
129 127
 						foreach ($list as $ipaddr) {
130 128
 							// find the wild card * in whitelisted ip (f.e. find position in "127.0.*" or "127*")
@@ -149,8 +147,7 @@  discard block
 block discarded – undo
149 147
 						show_error('Access to this application is not allowed');
150 148
 					}
151 149
 				}
152
-			}
153
-			else{
150
+			} else{
154 151
 				$logger->info('Whitelist IP access is not enabled in the configuration, ignore checking');
155 152
 			}
156 153
 		 }
Please login to merge, or discard this patch.
core/classes/Loader.php 1 patch
Braces   +15 added lines, -30 removed lines patch added patch discarded remove patch
@@ -107,8 +107,7 @@  discard block
 block discarded – undo
107 107
 			if ($moduleModelFilePath){
108 108
 				$logger->info('Found model [' . $class . '] from module [' .$module. '], the file path is [' .$moduleModelFilePath. '] we will used it');
109 109
 				$classFilePath = $moduleModelFilePath;
110
-			}
111
-			else{
110
+			} else{
112 111
 				$logger->info('Cannot find model [' . $class . '] from modules using the default location');
113 112
 			}
114 113
 			$logger->info('The model file path to be loaded is [' . $classFilePath . ']');
@@ -120,12 +119,10 @@  discard block
 block discarded – undo
120 119
 					$obj->{$instance} = $c;
121 120
 					static::$loaded[$instance] = $class;
122 121
 					$logger->info('Model [' . $class . '] --> ' . $classFilePath . ' loaded successfully.');
123
-				}
124
-				else{
122
+				} else{
125 123
 					show_error('The file '.$classFilePath.' exists but does not contain the class ['. $class . ']');
126 124
 				}
127
-			}
128
-			else{
125
+			} else{
129 126
 				show_error('Unable to find the model [' . $class . ']');
130 127
 			}
131 128
 		}
@@ -168,8 +165,7 @@  discard block
 block discarded – undo
168 165
 				$libraryFilePath = CORE_LIBRARY_PATH . $file;
169 166
 				$class = ucfirst($class);
170 167
 				$logger->info('This library is a system library');
171
-			}
172
-			else{
168
+			} else{
173 169
 				$logger->info('This library is not a system library');	
174 170
 				//first check if this library is in the module
175 171
 				$libraryFilePath = self::getLibraryPathUsingModuleInfo($class);
@@ -214,8 +210,7 @@  discard block
 block discarded – undo
214 210
 			if ($moduleFunctionPath){
215 211
 				$logger->info('Found helper [' . $function . '] from module [' .$module. '], the file path is [' .$moduleFunctionPath. '] we will used it');
216 212
 				$functionFilePath = $moduleFunctionPath;
217
-			}
218
-			else{
213
+			} else{
219 214
 				$logger->info('Cannot find helper [' . $function . '] from modules using the default location');
220 215
 			}
221 216
 			if (! $functionFilePath){
@@ -234,8 +229,7 @@  discard block
 block discarded – undo
234 229
 				require_once $functionFilePath;
235 230
 				static::$loaded['function_' . $function] = $functionFilePath;
236 231
 				$logger->info('Helper [' . $function . '] --> ' . $functionFilePath . ' loaded successfully.');
237
-			}
238
-			else{
232
+			} else{
239 233
 				show_error('Unable to find helper file [' . $file . ']');
240 234
 			}
241 235
 		}
@@ -268,8 +262,7 @@  discard block
 block discarded – undo
268 262
 			if ($moduleConfigPath){
269 263
 				$logger->info('Found config [' . $filename . '] from module [' .$module. '], the file path is [' .$moduleConfigPath. '] we will used it');
270 264
 				$configFilePath = $moduleConfigPath;
271
-			}
272
-			else{
265
+			} else{
273 266
 				$logger->info('Cannot find config [' . $filename . '] from modules using the default location');
274 267
 			}
275 268
 			$logger->info('The config file path to be loaded is [' . $configFilePath . ']');
@@ -283,8 +276,7 @@  discard block
 block discarded – undo
283 276
 					$logger->info('The custom application configuration loaded are listed below: ' . stringfy_vars($config));
284 277
 					unset($config);
285 278
 				}
286
-			}
287
-			else{
279
+			} else{
288 280
 				show_error('Unable to find config file ['. $configFilePath . ']');
289 281
 			}
290 282
 		}
@@ -323,8 +315,7 @@  discard block
 block discarded – undo
323 315
 			if ($moduleLanguagePath){
324 316
 				$logger->info('Found language [' . $language . '] from module [' .$module. '], the file path is [' .$moduleLanguagePath. '] we will used it');
325 317
 				$languageFilePath = $moduleLanguagePath;
326
-			}
327
-			else{
318
+			} else{
328 319
 				$logger->info('Cannot find language [' . $language . '] from modules using the default location');
329 320
 			}
330 321
 			if (! $languageFilePath){
@@ -377,8 +368,7 @@  discard block
 block discarded – undo
377 368
 					$module = $path[0];
378 369
 					$class = ucfirst($path[1]);
379 370
 				}
380
-			}
381
-			else{
371
+			} else{
382 372
 				$class = ucfirst($class);
383 373
 			}
384 374
 			if (! $module && !empty($obj->moduleName)){
@@ -499,8 +489,7 @@  discard block
 block discarded – undo
499 489
 				if (isset($path[1])){
500 490
 					$instance = strtolower($path[1]);
501 491
 				}
502
-			}
503
-			else{
492
+			} else{
504 493
 				$instance = strtolower($class);
505 494
 			}
506 495
 			return $instance;
@@ -522,8 +511,7 @@  discard block
 block discarded – undo
522 511
 			if ($moduleLibraryPath){
523 512
 				$logger->info('Found library [' . $class . '] from module [' .$module. '], the file path is [' .$moduleLibraryPath. '] we will used it');
524 513
 				$libraryFilePath = $moduleLibraryPath;
525
-			}
526
-			else{
514
+			} else{
527 515
 				$logger->info('Cannot find library [' . $class . '] from modules using the default location');
528 516
 			}
529 517
 			return $libraryFilePath;
@@ -547,12 +535,10 @@  discard block
 block discarded – undo
547 535
 					$obj->{$instance} = $c;
548 536
 					static::$loaded[$instance] = $class;
549 537
 					$logger->info('Library [' . $class . '] --> ' . $libraryFilePath . ' loaded successfully.');
550
-				}
551
-				else{
538
+				} else{
552 539
 					show_error('The file '.$libraryFilePath.' exists but does not contain the class '.$class);
553 540
 				}
554
-			}
555
-			else{
541
+			} else{
556 542
 				show_error('Unable to find library class [' . $class . ']');
557 543
 			}
558 544
 		}
@@ -578,8 +564,7 @@  discard block
 block discarded – undo
578 564
 				}
579 565
 				static::$loaded['lang_' . $language] = $languageFilePath;
580 566
 				$logger->info('Language [' . $language . '] --> ' . $languageFilePath . ' loaded successfully.');
581
-			}
582
-			else{
567
+			} else{
583 568
 				show_error('Unable to find language [' . $language . ']');
584 569
 			}
585 570
 		}
Please login to merge, or discard this patch.
core/classes/database/Database.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -156,8 +156,7 @@
 block discarded – undo
156 156
             $this->updateQueryBuilderAndRunnerProperties();
157 157
 
158 158
             return is_object($this->pdo);
159
-          }
160
-          catch (PDOException $e){
159
+          } catch (PDOException $e){
161 160
             $this->logger->fatal($e->getMessage());
162 161
             show_error('Cannot connect to Database.');
163 162
             return false;
Please login to merge, or discard this patch.
core/libraries/Pagination.php 1 patch
Braces   +13 added lines, -26 removed lines patch added patch discarded remove patch
@@ -48,16 +48,14 @@  discard block
 block discarded – undo
48 48
                 require_once CONFIG_PATH . 'config_pagination.php';
49 49
                 if (empty($config) || ! is_array($config)){
50 50
                     show_error('No configuration found in ' . CONFIG_PATH . 'config_pagination.php');
51
-                }
52
-				else{
51
+                } else{
53 52
 					$config = array_merge($config, $overwriteConfig);
54 53
 					$this->config = $config;
55 54
                     //put it gobally
56 55
 					Config::setAll($config);
57 56
 					unset($config);
58 57
 				}
59
-            }
60
-            else{
58
+            } else{
61 59
                 show_error('Unable to find the pagination configuration file');
62 60
             }
63 61
         }
@@ -115,18 +113,15 @@  discard block
 block discarded – undo
115 113
             $query = '';
116 114
              if ($queryString == ''){
117 115
                 $query = '?' . $pageQueryName . '=';
118
-            }
119
-            else{
116
+            } else{
120 117
                 $tab = explode($pageQueryName . '=', $queryString);
121 118
                 $nb = count($tab);
122 119
                 if ($nb == 1){
123 120
                     $query = '?' . $queryString . '&' . $pageQueryName . '=';
124
-                }
125
-                else{
121
+                } else{
126 122
                     if ($tab[0] == ''){
127 123
                         $query = '?' . $pageQueryName . '=';
128
-                    }
129
-                    else{
124
+                    } else{
130 125
                         $query = '?' . $tab[0] . '' . $pageQueryName . '=';
131 126
                     }
132 127
                 }
@@ -180,11 +175,9 @@  discard block
 block discarded – undo
180 175
             $navbar = null;
181 176
             if ($currentPageNumber == 1){
182 177
                 $navbar .= $this->buildPaginationLinkForFirstPage($begin, $end, $currentPageNumber);
183
-            }
184
-            else if ($currentPageNumber > 1 && $currentPageNumber < $numberOfPage){
178
+            } else if ($currentPageNumber > 1 && $currentPageNumber < $numberOfPage){
185 179
                 $navbar .= $this->buildPaginationLinkForMiddlePage($begin, $end, $currentPageNumber);
186
-            }
187
-            else if ($currentPageNumber == $numberOfPage){
180
+            } else if ($currentPageNumber == $numberOfPage){
188 181
                $navbar .= $this->buildPaginationLinkForLastPage($begin, $end, $currentPageNumber);
189 182
             }
190 183
             $navbar = $this->config['pagination_open'] . $navbar . $this->config['pagination_close'];
@@ -205,20 +198,17 @@  discard block
 block discarded – undo
205 198
             if ($numberOfLink % 2 == 0){
206 199
                 $start = $currentPageNumber - ($numberOfLink / 2) + 1;
207 200
                 $end   = $currentPageNumber + ($numberOfLink / 2);
208
-            }
209
-            else{
201
+            } else{
210 202
                 $start = $currentPageNumber - floor($numberOfLink / 2);
211 203
                 $end   = $currentPageNumber + floor($numberOfLink / 2);
212 204
             }
213 205
             if ($start <= 1){
214 206
                 $begin = 1;
215 207
                 $end   = $numberOfLink;
216
-            }
217
-            else if ($start > 1 && $end < $numberOfPage){
208
+            } else if ($start > 1 && $end < $numberOfPage){
218 209
                 $begin = $start;
219 210
                 $end = $end;
220
-            }
221
-            else{
211
+            } else{
222 212
                 $begin = ($numberOfPage - $numberOfLink) + 1;
223 213
                 $end   = $numberOfPage;
224 214
             }
@@ -245,8 +235,7 @@  discard block
 block discarded – undo
245 235
             for($i = $begin; $i <= $end; $i++){
246 236
                 if ($i == $currentPageNumber){
247 237
                     $navbar .= $this->config['active_link_open'] . $currentPageNumber . $this->config['active_link_close'];
248
-                }
249
-                else{
238
+                } else{
250 239
                     $navbar .= $this->config['digit_open'] 
251 240
                             . '<a href="' . $query . $i . '" ' . attributes_to_string($this->config['attributes']) . '>' . $i . '</a>' 
252 241
                             . $this->config['digit_close'];
@@ -274,8 +263,7 @@  discard block
 block discarded – undo
274 263
             for($i = $begin; $i <= $end; $i++){
275 264
                 if ($i == $currentPageNumber){
276 265
                     $navbar .= $this->config['active_link_open'] . $currentPageNumber . $this->config['active_link_close'];
277
-                }
278
-                else{
266
+                } else{
279 267
                     $navbar .= $this->config['digit_open'] 
280 268
                                     . '<a href="' . $query . $i . '"' . attributes_to_string($this->config['attributes']) . '>' . $i .'</a>' 
281 269
                                     . $this->config['digit_close'];
@@ -303,8 +291,7 @@  discard block
 block discarded – undo
303 291
                     $navbar .= $this->config['active_link_open'] 
304 292
                                 . $currentPageNumber 
305 293
                                 . $this->config['active_link_close'];
306
-                }
307
-                else{
294
+                } else{
308 295
                     $navbar .= $this->config['digit_open'] 
309 296
                                 . '<a href="' . $query . $i . '"' . attributes_to_string($this->config['attributes']) . '>' . $i . '</a>' 
310 297
                                 . $this->config['digit_close'];
Please login to merge, or discard this patch.
core/classes/Module.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,8 +61,7 @@
 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
 				}
Please login to merge, or discard this patch.
core/classes/Response.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -210,8 +210,7 @@  discard block
 block discarded – undo
210 210
 			if($moduleViewPath){
211 211
 				$path = $moduleViewPath;
212 212
 				$logger->info('Found view [' . $view . '] in module [' .$module. '], the file path is [' .$moduleViewPath. '] we will used it');
213
-			}
214
-			else{
213
+			} else{
215 214
 				$logger->info('Cannot find view [' . $view . '] in module [' .$module. '] using the default location');
216 215
 			}
217 216
 			
@@ -335,8 +334,7 @@  discard block
 block discarded – undo
335 334
 				$output = ob_get_clean();
336 335
 				self::sendHeaders(404);
337 336
 				echo $output;
338
-			}
339
-			else{
337
+			} else{
340 338
 				show_error('The 404 view [' .$path. '] does not exist');
341 339
 			}
342 340
 		}
@@ -359,8 +357,7 @@  discard block
 block discarded – undo
359 357
 				$output = ob_get_clean();
360 358
 				self::sendHeaders(503);
361 359
 				echo $output;
362
-			}
363
-			else{
360
+			} else{
364 361
 				//can't use show_error() at this time because some dependencies not yet loaded and to prevent loop
365 362
 				set_http_status_header(503);
366 363
 				echo 'The error view [' . $path . '] does not exist';
Please login to merge, or discard this patch.
core/classes/model/Model.php 1 patch
Braces   +28 added lines, -56 removed lines patch added patch discarded remove patch
@@ -148,8 +148,7 @@  discard block
 block discarded – undo
148 148
         public function __construct(Database $db = null){
149 149
             if (is_object($db)){
150 150
                 $this->setDatabaseInstance($db);
151
-            }
152
-            else{
151
+            } else{
153 152
                 $obj = & get_instance();
154 153
         		if (isset($obj->database) && is_object($obj->database)){
155 154
                     /**
@@ -265,8 +264,7 @@  discard block
 block discarded – undo
265 264
                 $this->trigger('after_create', $insert_id);
266 265
 				//if the table doesn't have the auto increment field or sequence, the value of 0 will be returned 
267 266
 				return ! $insert_id ? true : $insert_id;
268
-            }
269
-            else
267
+            } else
270 268
             {
271 269
                 return FALSE;
272 270
             }
@@ -303,8 +301,7 @@  discard block
 block discarded – undo
303 301
                 $result = $this->_database->update($data, $escape);
304 302
                 $this->trigger('after_update', array($data, $result));
305 303
                 return $result;
306
-            }
307
-            else
304
+            } else
308 305
             {
309 306
                 return FALSE;
310 307
             }
@@ -327,8 +324,7 @@  discard block
 block discarded – undo
327 324
 				$result = $this->_database->update($data, $escape);
328 325
                 $this->trigger('after_update', array($data, $result));
329 326
                 return $result;
330
-            }
331
-            else
327
+            } else
332 328
             {
333 329
                 return FALSE;
334 330
             }
@@ -345,8 +341,7 @@  discard block
 block discarded – undo
345 341
                 if (is_array($args[1])){
346 342
                     $data = array_pop($args);
347 343
                 }
348
-            }
349
-            else if (count($args) == 3){
344
+            } else if (count($args) == 3){
350 345
                 if (is_array($args[2])){
351 346
                     $data = array_pop($args);
352 347
                 }
@@ -387,8 +382,7 @@  discard block
 block discarded – undo
387 382
             {
388 383
                 $this->getQueryBuilder()->from($this->_table);	
389 384
 				$result = $this->_database->update(array( $this->soft_delete_key => TRUE ));
390
-            }
391
-            else
385
+            } else
392 386
             {
393 387
                 $this->getQueryBuilder()->from($this->_table); 
394 388
 				$result = $this->_database->delete();
@@ -411,8 +405,7 @@  discard block
 block discarded – undo
411 405
             {
412 406
                 $this->getQueryBuilder()->from($this->_table);	
413 407
 				$result = $this->_database->update(array( $this->soft_delete_key => TRUE ));
414
-            }
415
-            else
408
+            } else
416 409
             {
417 410
                 $this->getQueryBuilder()->from($this->_table); 
418 411
 				$result = $this->_database->delete();
@@ -433,8 +426,7 @@  discard block
 block discarded – undo
433 426
             {
434 427
                 $this->getQueryBuilder()->from($this->_table);	
435 428
 				$result = $this->_database->update(array( $this->soft_delete_key => TRUE ));
436
-            }
437
-            else
429
+            } else
438 430
             {
439 431
                 $this->getQueryBuilder()->from($this->_table); 
440 432
 				$result = $this->_database->delete();
@@ -496,8 +488,7 @@  discard block
 block discarded – undo
496 488
             if (count($args) == 2)
497 489
             {
498 490
                 list($key, $value) = $args;
499
-            }
500
-            else
491
+            } else
501 492
             {
502 493
                 $key = $this->primary_key;
503 494
                 $value = $args[0];
@@ -649,8 +640,7 @@  discard block
 block discarded – undo
649 640
             if (is_object($row))
650 641
             {
651 642
                 $row->created_at = date('Y-m-d H:i:s');
652
-            }
653
-            else
643
+            } else
654 644
             {
655 645
                 $row['created_at'] = date('Y-m-d H:i:s');
656 646
             }
@@ -662,8 +652,7 @@  discard block
 block discarded – undo
662 652
             if (is_object($row))
663 653
             {
664 654
                 $row->updated_at = date('Y-m-d H:i:s');
665
-            }
666
-            else
655
+            } else
667 656
             {
668 657
                 $row['updated_at'] = date('Y-m-d H:i:s');
669 658
             }
@@ -690,8 +679,7 @@  discard block
 block discarded – undo
690 679
                 if (is_array($row))
691 680
                 {
692 681
                     $row[$column] = unserialize($row[$column]);
693
-                }
694
-                else
682
+                } else
695 683
                 {
696 684
                     $row->$column = unserialize($row->$column);
697 685
                 }
@@ -711,8 +699,7 @@  discard block
 block discarded – undo
711 699
 					if (isset($row->$attr)){
712 700
 						unset($row->$attr);
713 701
 					}
714
-                }
715
-                else
702
+                } else
716 703
                 {
717 704
 					if (isset($row[$attr])){
718 705
 						unset($row[$attr]);
@@ -812,8 +799,7 @@  discard block
 block discarded – undo
812 799
                 {
813 800
                     $this->getQueryBuilder()->orderBy($key, $value);
814 801
                 }
815
-            }
816
-            else
802
+            } else
817 803
             {
818 804
                 $this->getQueryBuilder()->orderBy($criteria, $order);
819 805
             }
@@ -844,8 +830,7 @@  discard block
 block discarded – undo
844 830
                 {
845 831
                     $relationship = $value;
846 832
                     $options = array( 'primary_key' => $value . '_id', 'model' => $value . '_model' );
847
-                }
848
-                else
833
+                } else
849 834
                 {
850 835
                     $relationship = $key;
851 836
                     $options = $value;
@@ -855,15 +840,13 @@  discard block
 block discarded – undo
855 840
                 {
856 841
                     if (is_object($this->loaderInstance)){
857 842
                         $this->loaderInstance->model($options['model'], $relationship . '_model');
858
-                    }
859
-                    else{
843
+                    } else{
860 844
                         Loader::model($options['model'], $relationship . '_model');    
861 845
                     }
862 846
                     if (is_object($row))
863 847
                     {
864 848
                         $row->{$relationship} = $this->{$relationship . '_model'}->get($row->{$options['primary_key']});
865
-                    }
866
-                    else
849
+                    } else
867 850
                     {
868 851
                         $row[$relationship] = $this->{$relationship . '_model'}->get($row[$options['primary_key']]);
869 852
                     }
@@ -883,8 +866,7 @@  discard block
 block discarded – undo
883 866
                 {
884 867
                     $relationship = $value;
885 868
                     $options = array( 'primary_key' => $this->_table . '_id', 'model' => $value . '_model' );
886
-                }
887
-                else
869
+                } else
888 870
                 {
889 871
                     $relationship = $key;
890 872
                     $options = $value;
@@ -894,15 +876,13 @@  discard block
 block discarded – undo
894 876
                 {
895 877
                     if (is_object($this->loaderInstance)){
896 878
                         $this->loaderInstance->model($options['model'], $relationship . '_model');
897
-                    }
898
-                    else{
879
+                    } else{
899 880
                         Loader::model($options['model'], $relationship . '_model');    
900 881
                     }
901 882
                     if (is_object($row))
902 883
                     {
903 884
                         $row->{$relationship} = $this->{$relationship . '_model'}->get_many_by($options['primary_key'], $row->{$this->primary_key});
904
-                    }
905
-                    else
885
+                    } else
906 886
                     {
907 887
                         $row[$relationship] = $this->{$relationship . '_model'}->get_many_by($options['primary_key'], $row[$this->primary_key]);
908 888
                     }
@@ -970,14 +950,12 @@  discard block
 block discarded – undo
970 950
 				if (is_array($filter))
971 951
 				{
972 952
 					$this->getQueryBuilder()->in($field, $filter);
973
-				}
974
-				else
953
+				} else
975 954
 				{
976 955
 					if (is_int($field))
977 956
 					{
978 957
 						$this->getQueryBuilder()->where($filter);
979
-					}
980
-					else
958
+					} else
981 959
 					{
982 960
 						$this->getQueryBuilder()->where($field, $filter);
983 961
 					}
@@ -994,33 +972,27 @@  discard block
 block discarded – undo
994 972
             if (count($params) == 1 && is_array($params[0]))
995 973
             {
996 974
                 $this->_set_where_array($params[0]);
997
-            }
998
-            else if (count($params) == 1)
975
+            } else if (count($params) == 1)
999 976
             {
1000 977
                 $this->getQueryBuilder()->where($params[0]);
1001
-            }
1002
-        	else if (count($params) == 2)
978
+            } else if (count($params) == 2)
1003 979
     		{
1004 980
                 if (is_array($params[1]))
1005 981
                 {
1006 982
                     $this->getQueryBuilder()->in($params[0], $params[1]);
1007
-                }
1008
-                else
983
+                } else
1009 984
                 {
1010 985
                     $this->getQueryBuilder()->where($params[0], $params[1]);
1011 986
                 }
1012
-    		}
1013
-    		else if (count($params) == 3)
987
+    		} else if (count($params) == 3)
1014 988
     		{
1015 989
     			$this->getQueryBuilder()->where($params[0], $params[1], $params[2]);
1016
-    		}
1017
-            else
990
+    		} else
1018 991
             {
1019 992
                 if (is_array($params[1]))
1020 993
                 {
1021 994
                     $this->getQueryBuilder()->in($params[0], $params[1]);
1022
-                }
1023
-                else
995
+                } else
1024 996
                 {
1025 997
                     $this->getQueryBuilder()->where($params[0], $params[1]);
1026 998
                 }
Please login to merge, or discard this patch.