Passed
Pull Request — 1.0.0-dev (#1)
by
unknown
02:46
created
index.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -249,8 +249,7 @@
 block discarded – undo
249 249
 			ini_set('display_errors', 0);
250 250
 			if (version_compare(PHP_VERSION, '5.3', '>=')) {
251 251
 				error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
252
-			}
253
-			else {
252
+			} else {
254 253
 				error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
255 254
 			}
256 255
 		break;
Please login to merge, or discard this patch.
core/classes/cache/ApcCache.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -47,8 +47,7 @@  discard block
 block discarded – undo
47 47
             if($success === false){
48 48
                 $this->logger->info('No cache found for the key ['. $key .'], return false');
49 49
                 return false;
50
-            }
51
-            else{
50
+            } else{
52 51
                 $cacheInfo = $this->_getCacheInfo($key);
53 52
                 $expire = time();
54 53
                 if($cacheInfo){
@@ -74,8 +73,7 @@  discard block
 block discarded – undo
74 73
             if($result === false){
75 74
                 $this->logger->error('Can not write cache data for the key ['. $key .'], return false');
76 75
                 return false;
77
-            }
78
-            else{
76
+            } else{
79 77
                 $this->logger->info('Cache data saved for the key ['. $key .']');
80 78
                 return true;
81 79
             }
@@ -94,8 +92,7 @@  discard block
 block discarded – undo
94 92
             if($cacheInfo === false){
95 93
                 $this->logger->info('This cache data does not exists skipping');
96 94
                 return false;
97
-            }
98
-            else{
95
+            } else{
99 96
                 $this->logger->info('Found cache data for the key [' .$key. '] remove it');
100 97
                     return apc_delete($key) === true;
101 98
             }
@@ -119,8 +116,7 @@  discard block
 block discarded – undo
119 116
                             'ttl' => $cacheInfos['ttl']
120 117
                             );
121 118
                 return $data;
122
-            }
123
-            else{
119
+            } else{
124 120
                 $this->logger->info('This cache does not exists skipping');
125 121
                 return false;
126 122
             }
@@ -144,8 +140,7 @@  discard block
 block discarded – undo
144 140
             if(empty($cacheInfos['cache_list'])){
145 141
                 $this->logger->info('No cache data were found skipping');
146 142
                 return false;
147
-            }
148
-            else{
143
+            } else{
149 144
                 $this->logger->info('Found [' . count($cacheInfos) . '] cache data to remove');
150 145
                 return apc_clear_cache('user');
151 146
             }
Please login to merge, or discard this patch.
core/classes/cache/FileCache.php 1 patch
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -82,8 +82,7 @@  discard block
 block discarded – undo
82 82
                 // Unlinking when the file was expired
83 83
                 unlink($filePath);
84 84
                 return false;
85
-                }
86
-                else{
85
+                } else{
87 86
                     $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']) . ']');
88 87
                     return $data['data'];
89 88
                 }
@@ -120,8 +119,7 @@  discard block
 block discarded – undo
120 119
                 $this->logger->error('Can not write cache data into file [' .$filePath. '] for the key ['. $key .'], return false');
121 120
                 fclose($handle);
122 121
                 return false;
123
-            }
124
-            else{
122
+            } else{
125 123
                 $this->logger->info('Cache data saved into file [' .$filePath. '] for the key ['. $key .']');
126 124
                 fclose($handle);
127 125
                 chmod($filePath, 0640);
@@ -143,8 +141,7 @@  discard block
 block discarded – undo
143 141
             if(! file_exists($filePath)){
144 142
                 $this->logger->info('This cache file does not exists skipping');
145 143
                 return false;
146
-            }
147
-            else{
144
+            } else{
148 145
                 $this->logger->info('Found cache file [' .$filePath. '] remove it');
149 146
                     unlink($filePath);
150 147
                 return true;
@@ -197,8 +194,7 @@  discard block
 block discarded – undo
197 194
             $list = glob(CACHE_PATH . '*.cache');
198 195
             if(! $list){
199 196
                 $this->logger->info('No cache files were found skipping');
200
-            }
201
-            else{
197
+            } else{
202 198
                 $this->logger->info('Found [' . count($list) . '] cache files to remove if expired');
203 199
                 foreach ($list as $file) {
204 200
                     $this->logger->debug('Processing the cache file [' . $file . ']');
@@ -206,12 +202,10 @@  discard block
 block discarded – undo
206 202
                         $data = @unserialize($this->compressCacheData ? gzinflate($data) : $data);
207 203
                         if(! $data){
208 204
                             $this->logger->warning('Can not unserialize the cache data for file [' . $file . ']');
209
-                        }
210
-                        else if(time() > $data['expire']){
205
+                        } else if(time() > $data['expire']){
211 206
                             $this->logger->info('The cache data for file [' . $file . '] already expired remove it');
212 207
                             unlink($file);
213
-                        }
214
-                        else{
208
+                        } else{
215 209
                             $this->logger->info('The cache data for file [' . $file . '] not yet expired skip it');
216 210
                         }
217 211
                 }
@@ -226,8 +220,7 @@  discard block
 block discarded – undo
226 220
             $list = glob(CACHE_PATH . '*.cache');
227 221
             if(! $list){
228 222
                 $this->logger->info('No cache files were found skipping');
229
-            }
230
-            else{
223
+            } else{
231 224
                 $this->logger->info('Found [' . count($list) . '] cache files to remove');
232 225
                 foreach ($list as $file) {
233 226
                     $this->logger->debug('Processing the cache file [' . $file . ']');
@@ -254,8 +247,7 @@  discard block
 block discarded – undo
254 247
 				
255 248
                 $this->logger->warning('The zlib extension is not loaded set cache compress data to FALSE');
256 249
                 $this->compressCacheData = false;
257
-            }
258
-            else{
250
+            } else{
259 251
                 $this->compressCacheData = $status;
260 252
             }
261 253
             return $this;
Please login to merge, or discard this patch.
core/classes/Router.php 1 patch
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -242,8 +242,7 @@  discard block
 block discarded – undo
242 242
             //if the application is running in CLI mode use the first argument
243 243
             else if(IS_CLI && isset($_SERVER['argv'][1])){
244 244
                 $routeUri = $_SERVER['argv'][1];
245
-            }
246
-            else if(isset($_SERVER['REQUEST_URI'])){
245
+            } else if(isset($_SERVER['REQUEST_URI'])){
247 246
                 $routeUri = $_SERVER['REQUEST_URI'];
248 247
             }
249 248
             $this->logger->debug('Check if URL suffix is enabled in the configuration');
@@ -339,15 +338,13 @@  discard block
 block discarded – undo
339 338
                 if(! class_exists($controller, false)){
340 339
                     $e404 = true;
341 340
                     $this->logger->warning('The controller file [' .$classFilePath. '] exists but does not contain the class [' . $controller . ']');
342
-                }
343
-                else{
341
+                } else{
344 342
                     $controllerInstance = new $controller();
345 343
                     $controllerMethod = $this->getMethod();
346 344
                     if(! method_exists($controllerInstance, $controllerMethod)){
347 345
                         $e404 = true;
348 346
                         $this->logger->warning('The controller [' . $controller . '] exist but does not contain the method [' . $controllerMethod . ']');
349
-                    }
350
-                    else{
347
+                    } else{
351 348
                         $this->logger->info('Routing data is set correctly now GO!');
352 349
                         call_user_func_array(array($controllerInstance, $controllerMethod), $this->args);
353 350
                         //render the final page to user
@@ -355,8 +352,7 @@  discard block
 block discarded – undo
355 352
                         get_instance()->response->renderFinalPage();
356 353
                     }
357 354
                 }
358
-            }
359
-            else{
355
+            } else{
360 356
                 $this->logger->info('The controller file path [' . $classFilePath . '] does not exist');
361 357
                 $e404 = true;
362 358
             }
@@ -462,8 +458,7 @@  discard block
 block discarded – undo
462 458
                         $this->logger->info('The current request use the module [' . $moduleControllerMethod[0] . ']');
463 459
                         $this->module = $moduleControllerMethod[0];
464 460
                         $moduleControllerMethod = explode('@', $moduleControllerMethod[1]);
465
-                    }
466
-                    else{
461
+                    } else{
467 462
                         $this->logger->info('The current request does not use the module');
468 463
                         $moduleControllerMethod = explode('@', $this->callback[$index]);
469 464
                     }
@@ -519,8 +514,7 @@  discard block
 block discarded – undo
519 514
                     }
520 515
                     //args
521 516
                     $this->args = $segment;
522
-                }
523
-                else{
517
+                } else{
524 518
                     $this->logger->info('The application contains a loaded module will check if the current request is found in the module list');
525 519
                     if(in_array($segment[0], $modules)){
526 520
                         $this->logger->info('Found, the current request use the module [' . $segment[0] . ']');
@@ -534,8 +528,7 @@  discard block
 block discarded – undo
534 528
                             if(! $path){
535 529
                                 $this->logger->info('The controller [' . $this->controller . '] not found in the module, may be will use the module [' . $this->module . '] as controller');
536 530
                                 $this->controller = $this->module;
537
-                            }
538
-                            else{
531
+                            } else{
539 532
                                 $this->controllerPath = $path;
540 533
                                 array_shift($segment);
541 534
                             }
@@ -547,8 +540,7 @@  discard block
 block discarded – undo
547 540
                         }
548 541
                         //the remaining is for args
549 542
                         $this->args = $segment;
550
-                    }
551
-                    else{
543
+                    } else{
552 544
                         $this->logger->info('The current request information is not found in the module list');
553 545
                         //controller
554 546
                         if(isset($segment[0])){
Please login to merge, or discard this patch.
core/classes/model/Model.php 1 patch
Braces   +18 added lines, -36 removed lines patch added patch discarded remove patch
@@ -264,8 +264,7 @@  discard block
 block discarded – undo
264 264
                 $this->trigger('after_create', $insert_id);
265 265
                 //if the table doesn't have the auto increment field or sequence, the value of 0 will be returned 
266 266
                 return ! $insert_id ? true : $insert_id;
267
-            }
268
-            else
267
+            } else
269 268
             {
270 269
                 return FALSE;
271 270
             }
@@ -342,8 +341,7 @@  discard block
 block discarded – undo
342 341
                 if (is_array($args[1])) {
343 342
                     $data = array_pop($args);
344 343
                 }
345
-            }
346
-            else if (count($args) == 3) {
344
+            } else if (count($args) == 3) {
347 345
                 if (is_array($args[2])) {
348 346
                     $data = array_pop($args);
349 347
                 }
@@ -384,8 +382,7 @@  discard block
 block discarded – undo
384 382
             {
385 383
                 $this->getQueryBuilder()->from($this->_table);	
386 384
                 $result = $this->_database->update(array( $this->soft_delete_key => TRUE ));
387
-            }
388
-            else
385
+            } else
389 386
             {
390 387
                 $this->getQueryBuilder()->from($this->_table); 
391 388
                 $result = $this->_database->delete();
@@ -408,8 +405,7 @@  discard block
 block discarded – undo
408 405
             {
409 406
                 $this->getQueryBuilder()->from($this->_table);	
410 407
                 $result = $this->_database->update(array( $this->soft_delete_key => TRUE ));
411
-            }
412
-            else
408
+            } else
413 409
             {
414 410
                 $this->getQueryBuilder()->from($this->_table); 
415 411
                 $result = $this->_database->delete();
@@ -430,8 +426,7 @@  discard block
 block discarded – undo
430 426
             {
431 427
                 $this->getQueryBuilder()->from($this->_table);	
432 428
                 $result = $this->_database->update(array( $this->soft_delete_key => TRUE ));
433
-            }
434
-            else
429
+            } else
435 430
             {
436 431
                 $this->getQueryBuilder()->from($this->_table); 
437 432
                 $result = $this->_database->delete();
@@ -704,8 +699,7 @@  discard block
 block discarded – undo
704 699
                     if (isset($row->$attr)){
705 700
                         unset($row->$attr);
706 701
                     }
707
-                }
708
-                else
702
+                } else
709 703
                 {
710 704
                     if (isset($row[$attr])){
711 705
                         unset($row[$attr]);
@@ -846,15 +840,13 @@  discard block
 block discarded – undo
846 840
                 {
847 841
                     if (is_object($this->loaderInstance)) {
848 842
                         $this->loaderInstance->model($options['model'], $relationship . '_model');
849
-                    }
850
-                    else {
843
+                    } else {
851 844
                         Loader::model($options['model'], $relationship . '_model');    
852 845
                     }
853 846
                     if (is_object($row))
854 847
                     {
855 848
                         $row->{$relationship} = $this->{$relationship . '_model'}->get($row->{$options['primary_key']});
856
-                    }
857
-                    else
849
+                    } else
858 850
                     {
859 851
                         $row[$relationship] = $this->{$relationship . '_model'}->get($row[$options['primary_key']]);
860 852
                     }
@@ -884,15 +876,13 @@  discard block
 block discarded – undo
884 876
                 {
885 877
                     if (is_object($this->loaderInstance)) {
886 878
                         $this->loaderInstance->model($options['model'], $relationship . '_model');
887
-                    }
888
-                    else {
879
+                    } else {
889 880
                         Loader::model($options['model'], $relationship . '_model');    
890 881
                     }
891 882
                     if (is_object($row))
892 883
                     {
893 884
                         $row->{$relationship} = $this->{$relationship . '_model'}->get_many_by($options['primary_key'], $row->{$this->primary_key});
894
-                    }
895
-                    else
885
+                    } else
896 886
                     {
897 887
                         $row[$relationship] = $this->{$relationship . '_model'}->get_many_by($options['primary_key'], $row[$this->primary_key]);
898 888
                     }
@@ -960,14 +950,12 @@  discard block
 block discarded – undo
960 950
                 if (is_array($filter))
961 951
                 {
962 952
                     $this->getQueryBuilder()->in($field, $filter);
963
-                }
964
-                else
953
+                } else
965 954
                 {
966 955
                     if (is_int($field))
967 956
                     {
968 957
                         $this->getQueryBuilder()->where($filter);
969
-                    }
970
-                    else
958
+                    } else
971 959
                     {
972 960
                         $this->getQueryBuilder()->where($field, $filter);
973 961
                     }
@@ -984,33 +972,27 @@  discard block
 block discarded – undo
984 972
             if (count($params) == 1 && is_array($params[0]))
985 973
             {
986 974
                 $this->_set_where_array($params[0]);
987
-            }
988
-            else if (count($params) == 1)
975
+            } else if (count($params) == 1)
989 976
             {
990 977
                 $this->getQueryBuilder()->where($params[0]);
991
-            }
992
-            else if (count($params) == 2)
978
+            } else if (count($params) == 2)
993 979
             {
994 980
                 if (is_array($params[1]))
995 981
                 {
996 982
                     $this->getQueryBuilder()->in($params[0], $params[1]);
997
-                }
998
-                else
983
+                } else
999 984
                 {
1000 985
                     $this->getQueryBuilder()->where($params[0], $params[1]);
1001 986
                 }
1002
-            }
1003
-            else if (count($params) == 3)
987
+            } else if (count($params) == 3)
1004 988
             {
1005 989
                 $this->getQueryBuilder()->where($params[0], $params[1], $params[2]);
1006
-            }
1007
-            else
990
+            } else
1008 991
             {
1009 992
                 if (is_array($params[1]))
1010 993
                 {
1011 994
                     $this->getQueryBuilder()->in($params[0], $params[1]);
1012
-                }
1013
-                else
995
+                } else
1014 996
                 {
1015 997
                     $this->getQueryBuilder()->where($params[0], $params[1]);
1016 998
                 }
Please login to merge, or discard this patch.
core/libraries/Pagination.php 1 patch
Braces   +10 added lines, -20 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
         }
@@ -177,11 +175,9 @@  discard block
 block discarded – undo
177 175
             $navbar = null;
178 176
             if ($currentPageNumber == 1){
179 177
                 $navbar .= $this->buildPaginationLinkForFirstPage($begin, $end, $currentPageNumber);
180
-            }
181
-            else if ($currentPageNumber > 1 && $currentPageNumber < $numberOfPage){
178
+            } else if ($currentPageNumber > 1 && $currentPageNumber < $numberOfPage){
182 179
                 $navbar .= $this->buildPaginationLinkForMiddlePage($begin, $end, $currentPageNumber);
183
-            }
184
-            else if ($currentPageNumber == $numberOfPage){
180
+            } else if ($currentPageNumber == $numberOfPage){
185 181
                 $navbar .= $this->buildPaginationLinkForLastPage($begin, $end, $currentPageNumber);
186 182
             }
187 183
             $navbar = $this->config['pagination_open'] . $navbar . $this->config['pagination_close'];
@@ -202,20 +198,17 @@  discard block
 block discarded – undo
202 198
             if ($numberOfLink % 2 == 0) {
203 199
                 $start = $currentPageNumber - ($numberOfLink / 2) + 1;
204 200
                 $end   = $currentPageNumber + ($numberOfLink / 2);
205
-            }
206
-            else {
201
+            } else {
207 202
                 $start = $currentPageNumber - floor($numberOfLink / 2);
208 203
                 $end   = $currentPageNumber + floor($numberOfLink / 2);
209 204
             }
210 205
             if ($start <= 1) {
211 206
                 $begin = 1;
212 207
                 $end   = $numberOfLink;
213
-            }
214
-            else if ($start > 1 && $end < $numberOfPage) {
208
+            } else if ($start > 1 && $end < $numberOfPage) {
215 209
                 $begin = $start;
216 210
                 $end = $end;
217
-            }
218
-            else {
211
+            } else {
219 212
                 $begin = ($numberOfPage - $numberOfLink) + 1;
220 213
                 $end   = $numberOfPage;
221 214
             }
@@ -242,8 +235,7 @@  discard block
 block discarded – undo
242 235
             for ($i = $begin; $i <= $end; $i++) {
243 236
                 if ($i == $currentPageNumber) {
244 237
                     $navbar .= $this->config['active_link_open'] . $currentPageNumber . $this->config['active_link_close'];
245
-                }
246
-                else {
238
+                } else {
247 239
                     $navbar .= $this->config['digit_open'] 
248 240
                             . '<a href="' . $query . $i . '" ' . attributes_to_string($this->config['attributes']) . '>' . $i . '</a>' 
249 241
                             . $this->config['digit_close'];
@@ -271,8 +263,7 @@  discard block
 block discarded – undo
271 263
             for ($i = $begin; $i <= $end; $i++) {
272 264
                 if ($i == $currentPageNumber) {
273 265
                     $navbar .= $this->config['active_link_open'] . $currentPageNumber . $this->config['active_link_close'];
274
-                }
275
-                else {
266
+                } else {
276 267
                     $navbar .= $this->config['digit_open'] 
277 268
                                     . '<a href="' . $query . $i . '"' . attributes_to_string($this->config['attributes']) . '>' . $i . '</a>' 
278 269
                                     . $this->config['digit_close'];
@@ -300,8 +291,7 @@  discard block
 block discarded – undo
300 291
                     $navbar .= $this->config['active_link_open'] 
301 292
                                 . $currentPageNumber 
302 293
                                 . $this->config['active_link_close'];
303
-                }
304
-                else {
294
+                } else {
305 295
                     $navbar .= $this->config['digit_open'] 
306 296
                                 . '<a href="' . $query . $i . '"' . attributes_to_string($this->config['attributes']) . '>' . $i . '</a>' 
307 297
                                 . $this->config['digit_close'];
Please login to merge, or discard this patch.
core/common.php 1 patch
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -222,16 +222,14 @@  discard block
 block discarded – undo
222 222
                             );
223 223
             if (isset($http_status[$code])){
224 224
                 $text = $http_status[$code];
225
-            }
226
-            else{
225
+            } else{
227 226
                 show_error('No HTTP status text found for your code please check it.');
228 227
             }
229 228
         }
230 229
 		
231 230
         if (strpos(php_sapi_name(), 'cgi') === 0){
232 231
             header('Status: ' . $code . ' ' . $text, TRUE);
233
-        }
234
-        else{
232
+        } else{
235 233
             $proto = 'HTTP/1.1';
236 234
             if(isset($_SERVER['SERVER_PROTOCOL'])){
237 235
                 $proto = $_SERVER['SERVER_PROTOCOL'];
@@ -323,8 +321,7 @@  discard block
 block discarded – undo
323 321
     function php_exception_handler($ex){
324 322
         if (str_ireplace(array('off', 'none', 'no', 'false', 'null'), '', ini_get('display_errors'))){
325 323
             show_error('An exception is occured in file '. $ex->getFile() .' at line ' . $ex->getLine() . ' raison : ' . $ex->getMessage(), 'PHP Exception #' . $ex->getCode());
326
-        }
327
-        else{
324
+        } else{
328 325
             save_to_log('error', 'An exception is occured in file ' . $ex->getFile() . ' at line ' . $ex->getLine() . ' raison : ' . $ex->getMessage(), 'PHP Exception');
329 326
         }
330 327
         return true;
@@ -440,15 +437,13 @@  discard block
 block discarded – undo
440 437
     function clean_input($str){
441 438
         if (is_array($str)){
442 439
             $str = array_map('clean_input', $str);
443
-        }
444
-        else if (is_object($str)){
440
+        } else if (is_object($str)){
445 441
             $obj = $str;
446 442
             foreach ($str as $var => $value) {
447 443
                 $obj->$var = clean_input($value);
448 444
             }
449 445
             $str = $obj;
450
-        }
451
-        else{
446
+        } else{
452 447
             $str = htmlspecialchars(strip_tags($str), ENT_QUOTES, 'UTF-8');
453 448
         }
454 449
         return $str;
@@ -521,8 +516,7 @@  discard block
 block discarded – undo
521 516
                     session_save_path($sessionSavePath);
522 517
                     $logger->info('Session save path: ' . $sessionSavePath);
523 518
                 }
524
-            }
525
-            else if ($sessionHandler == 'database'){
519
+            } else if ($sessionHandler == 'database'){
526 520
                 //load database session handle library
527 521
                 //Database Session handler Model
528 522
                 require_once CORE_CLASSES_MODEL_PATH . 'DBSessionHandlerModel.php';
@@ -530,8 +524,7 @@  discard block
 block discarded – undo
530 524
                 $DBS =& class_loader('DBSessionHandler', 'classes');
531 525
                 session_set_save_handler($DBS, true);
532 526
                 $logger->info('session save path: ' . get_config('session_save_path'));
533
-            }
534
-            else{
527
+            } else{
535 528
                 show_error('Invalid session handler configuration');
536 529
             }
537 530
             $lifetime = get_config('session_cookie_lifetime', 0);
Please login to merge, or discard this patch.