Passed
Push — 1.0.0-dev ( d422fd...3d5bea )
by nguereza
02:49
created
core/libraries/Pagination.php 1 patch
Braces   +13 added lines, -26 removed lines patch added patch discarded remove patch
@@ -41,8 +41,7 @@  discard block
 block discarded – undo
41 41
                 require_once CONFIG_PATH . 'config_pagination.php';
42 42
                 if(empty($config) || ! is_array($config)){
43 43
                     show_error('No configuration found in ' . CONFIG_PATH . 'config_pagination.php');
44
-                }
45
-				else{
44
+                } else{
46 45
 					if(! empty($overwriteConfig)){
47 46
 						$config = array_merge($config, $overwriteConfig);
48 47
 					}
@@ -50,8 +49,7 @@  discard block
 block discarded – undo
50 49
 					Config::setAll($config);
51 50
 					unset($config);
52 51
 				}
53
-            }
54
-            else{
52
+            } else{
55 53
                 show_error('Unable to find the pagination configuration file');
56 54
             }
57 55
         }
@@ -83,18 +81,15 @@  discard block
 block discarded – undo
83 81
             $currentUrl = Url::current();
84 82
             if($queryString == ''){
85 83
                 $query = '?' . $pageQueryName . '=';
86
-            }
87
-            else{
84
+            } else{
88 85
                 $tab = explode($pageQueryName . '=', $queryString);
89 86
                 $nb = count($tab);
90 87
                 if($nb == 1){
91 88
                     $query = '?' . $queryString . '&' . $pageQueryName . '=';
92
-                }
93
-                else{
89
+                } else{
94 90
                     if($tab[0] == ''){
95 91
                         $query = '?' . $pageQueryName . '=';
96
-                    }
97
-                    else{
92
+                    } else{
98 93
                         $query = '?' . $tab[0] . '' . $pageQueryName . '=';
99 94
                     }
100 95
                 }
@@ -113,20 +108,17 @@  discard block
 block discarded – undo
113 108
             if($numberOfLink % 2 == 0){
114 109
                 $start = $currentPageNumber - ($numberOfLink / 2) + 1;
115 110
                 $end = $currentPageNumber + ($numberOfLink / 2);
116
-            }
117
-            else{
111
+            } else{
118 112
                 $start = $currentPageNumber - floor($numberOfLink / 2);
119 113
                 $end = $currentPageNumber + floor($numberOfLink / 2);
120 114
             }
121 115
             if($start <= 1){
122 116
                 $begin = 1;
123 117
                 $end = $numberOfLink;
124
-            }
125
-            else if($start > 1 && $end < $numberOfPage){
118
+            } else if($start > 1 && $end < $numberOfPage){
126 119
                 $begin = $start;
127 120
                 $end = $end;
128
-            }
129
-            else{
121
+            } else{
130 122
                 $begin = ($numberOfPage - $numberOfLink) + 1;
131 123
                 $end = $numberOfPage;
132 124
             }
@@ -138,32 +130,27 @@  discard block
 block discarded – undo
138 130
                 for($i = $begin; $i <= $end; $i++){
139 131
                     if($i == $currentPageNumber){
140 132
                         $navbar .= $this->config['active_link_open'] . $currentPageNumber . $this->config['active_link_close'];
141
-                    }
142
-                    else{
133
+                    } else{
143 134
                         $navbar .= $this->config['digit_open'] . '<a href="' . $query . $i . '" ' . attributes_to_string($this->config['attributes']) . '>' . $i . '</a>' . $this->config['digit_close'];
144 135
                     }
145 136
                 }
146 137
                 $navbar .= $this->config['next_open'] . '<a href="' . $query . ($currentPageNumber + 1) . '">' . $this->config['next_text'] . '</a>' . $this->config['next_close'];
147
-            }
148
-            else if($currentPageNumber > 1 && $currentPageNumber < $numberOfPage){
138
+            } else if($currentPageNumber > 1 && $currentPageNumber < $numberOfPage){
149 139
                 $navbar .= $this->config['previous_open'] . '<a href="' . $query . ($currentPageNumber - 1) . '">' . $this->config['previous_text'] . '</a>' . $this->config['previous_close'];
150 140
                 for($i = $begin; $i <= $end; $i++){
151 141
                     if($i == $currentPageNumber){
152 142
                         $navbar .= $this->config['active_link_open'] . $currentPageNumber . $this->config['active_link_close'];
153
-                    }
154
-                    else{
143
+                    } else{
155 144
                         $navbar .= $this->config['digit_open'] . '<a href="' . $query . $i . '"' . attributes_to_string($this->config['attributes']) . '>' . $i .'</a>' . $this->config['digit_close'];
156 145
                     }
157 146
                 }
158 147
                 $navbar .= $this->config['next_open']."<a href='$query".($currentPageNumber + 1)."'>".$this->config['next_text']."</a>".$this->config['next_close'];
159
-            }
160
-            else if($currentPageNumber == $numberOfPage){
148
+            } else if($currentPageNumber == $numberOfPage){
161 149
                 $navbar .= $this->config['previous_open'] . '<a href="' . $query . ($currentPageNumber - 1) . '">' . $this->config['previous_text'] . '</a>' . $this->config['previous_close'];
162 150
                 for($i = $begin; $i <= $end; $i++){
163 151
                     if($i == $currentPageNumber){
164 152
                         $navbar .= $this->config['active_link_open'] . $currentPageNumber . $this->config['active_link_close'];
165
-                    }
166
-                    else{
153
+                    } else{
167 154
                         $navbar .= $this->config['digit_open'] . '<a href="' . $query . $i . '"' . attributes_to_string($this->config['attributes']) . '>' . $i . '</a>' . $this->config['digit_close'];
168 155
                     }
169 156
                 }
Please login to merge, or discard this patch.
core/libraries/Browser.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -921,20 +921,15 @@
 block discarded – undo
921 921
                     if(preg_match('#trident/([0-9\.]+);#i', $this->_agent, $aresult)){
922 922
                         if($aresult[1] == '3.1'){
923 923
                             $this->setVersion('7.0');
924
-                        }
925
-                        else if($aresult[1] == '4.0'){
924
+                        } else if($aresult[1] == '4.0'){
926 925
                             $this->setVersion('8.0');
927
-                        }
928
-                        else if($aresult[1] == '5.0'){
926
+                        } else if($aresult[1] == '5.0'){
929 927
                             $this->setVersion('9.0');
930
-                        }
931
-                        else if($aresult[1] == '6.0'){
928
+                        } else if($aresult[1] == '6.0'){
932 929
                             $this->setVersion('10.0');
933
-                        }
934
-                        else if($aresult[1] == '7.0'){
930
+                        } else if($aresult[1] == '7.0'){
935 931
                             $this->setVersion('11.0');
936
-                        }
937
-                        else if($aresult[1] == '8.0'){
932
+                        } else if($aresult[1] == '8.0'){
938 933
                             $this->setVersion('11.0');
939 934
                         }
940 935
                     }
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/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) === true;
116 112
 			}
@@ -134,8 +130,7 @@  discard block
 block discarded – undo
134 130
 							'ttl' => $cacheInfos['ttl']
135 131
 							);
136 132
 				return $data;
137
-			}
138
-			else{
133
+			} else{
139 134
 				$this->logger->info('This cache does not exists skipping');
140 135
 				return false;
141 136
 			}
@@ -159,8 +154,7 @@  discard block
 block discarded – undo
159 154
 			if(empty($cacheInfos['cache_list'])){
160 155
 				$this->logger->info('No cache data were found skipping');
161 156
 				return false;
162
-			}
163
-			else{
157
+			} else{
164 158
 				$this->logger->info('Found [' . count($cacheInfos) . '] cache data to remove');
165 159
 				return apc_clear_cache('user');
166 160
 			}
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
 		     }
@@ -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;
@@ -179,16 +175,14 @@  discard block
 block discarded – undo
179 175
 			if(! file_exists($filePath)){
180 176
 				$this->logger->info('This cache file does not exists skipping');
181 177
 				return false;
182
-			}
183
-			else{
178
+			} else{
184 179
 				$this->logger->info('Found cache file [' .$filePath. '] check the validity');
185 180
 	      		$data = file_get_contents($filePath);
186 181
 				$data = @unserialize($this->compressCacheData ? gzinflate($data) : $data);
187 182
 				if(! $data){
188 183
 					$this->logger->warning('Can not unserialize the cache data for file [' . $filePath . ']');
189 184
 					return false;
190
-				}
191
-				else{
185
+				} else{
192 186
 					$this->logger->info('This cache data is OK check for expire');
193 187
 					if(isset($data['expire']) && $data['expire'] > time()){
194 188
 						$this->logger->info('This cache not yet expired return cache informations');
@@ -198,8 +192,7 @@  discard block
 block discarded – undo
198 192
 							'ttl' => $data['ttl']
199 193
 							);
200 194
 						return $info;
201
-					}
202
-					else{
195
+					} else{
203 196
 						$this->logger->info('This cache already expired return false');
204 197
 						return false;
205 198
 					}
@@ -216,8 +209,7 @@  discard block
 block discarded – undo
216 209
 			$list = glob(CACHE_PATH . '*.cache');
217 210
 			if(! $list){
218 211
 				$this->logger->info('No cache files were found skipping');
219
-			}
220
-			else{
212
+			} else{
221 213
 				$this->logger->info('Found [' . count($list) . '] cache files to remove if expired');
222 214
 				foreach ($list as $file) {
223 215
 					$this->logger->debug('Processing the cache file [' . $file . ']');
@@ -225,12 +217,10 @@  discard block
 block discarded – undo
225 217
 		      		$data = @unserialize($this->compressCacheData ? gzinflate($data) : $data);
226 218
 		      		if(! $data){
227 219
 		      			$this->logger->warning('Can not unserialize the cache data for file [' . $file . ']');
228
-		      		}
229
-		      		else if(time() > $data['expire']){
220
+		      		} else if(time() > $data['expire']){
230 221
 		      			$this->logger->info('The cache data for file [' . $file . '] already expired remove it');
231 222
 		      			unlink($file);
232
-		      		}
233
-		      		else{
223
+		      		} else{
234 224
 		      			$this->logger->info('The cache data for file [' . $file . '] not yet expired skip it');
235 225
 		      		}
236 226
 				}
@@ -245,8 +235,7 @@  discard block
 block discarded – undo
245 235
 			$list = glob(CACHE_PATH . '*.cache');
246 236
 			if(! $list){
247 237
 				$this->logger->info('No cache files were found skipping');
248
-			}
249
-			else{
238
+			} else{
250 239
 				$this->logger->info('Found [' . count($list) . '] cache files to remove');
251 240
 				foreach ($list as $file) {
252 241
 					$this->logger->debug('Processing the cache file [' . $file . ']');
@@ -273,8 +262,7 @@  discard block
 block discarded – undo
273 262
 				
274 263
 				$this->logger->warning('The zlib extension is not loaded set cache compress data to FALSE');
275 264
 				$this->compressCacheData = false;
276
-			}
277
-			else{
265
+			} else{
278 266
 				$this->compressCacheData = $status;
279 267
 			}
280 268
 			return $this;
Please login to merge, or discard this patch.
core/classes/Loader.php 1 patch
Braces   +17 added lines, -34 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
 			}
@@ -252,8 +246,7 @@  discard block
 block discarded – undo
252 246
 				$libraryFilePath = CORE_LIBRARY_PATH . $file;
253 247
 				$class = ucfirst($class);
254 248
 				$logger->info('This library is a system library');
255
-			}
256
-			else{
249
+			} else{
257 250
 				$logger->info('This library is not a system library');	
258 251
 				//first check if this library is in the module
259 252
 				$logger->debug('Checking library [' . $class . '] from module list ...');
@@ -265,8 +258,7 @@  discard block
 block discarded – undo
265 258
 						$searchModuleName = $path[0];
266 259
 						$class = ucfirst($path[1]);
267 260
 					}
268
-				}
269
-				else{
261
+				} else{
270 262
 					$class = ucfirst($class);
271 263
 				}
272 264
 				if(! $searchModuleName && !empty($obj->moduleName)){
@@ -276,8 +268,7 @@  discard block
 block discarded – undo
276 268
 				if($moduleLibraryPath){
277 269
 					$logger->info('Found library [' . $class . '] from module [' .$searchModuleName. '], the file path is [' .$moduleLibraryPath. '] we will used it');
278 270
 					$libraryFilePath = $moduleLibraryPath;
279
-				}
280
-				else{
271
+				} else{
281 272
 					$logger->info('Cannot find library [' . $class . '] from modules using the default location');
282 273
 				}
283 274
 			}
@@ -301,12 +292,10 @@  discard block
 block discarded – undo
301 292
 					$obj->{$instance} = $c;
302 293
 					static::$loaded[$instance] = $class;
303 294
 					$logger->info('Library [' . $class . '] --> ' . $libraryFilePath . ' loaded successfully.');
304
-				}
305
-				else{
295
+				} else{
306 296
 					show_error('The file '.$libraryFilePath.' exists but does not contain the class '.$class);
307 297
 				}
308
-			}
309
-			else{
298
+			} else{
310 299
 				show_error('Unable to find library class [' . $class . ']');
311 300
 			}
312 301
 		}
@@ -350,8 +339,7 @@  discard block
 block discarded – undo
350 339
 			if($moduleFunctionPath){
351 340
 				$logger->info('Found helper [' . $function . '] from module [' .$searchModuleName. '], the file path is [' .$moduleFunctionPath. '] we will used it');
352 341
 				$functionFilePath = $moduleFunctionPath;
353
-			}
354
-			else{
342
+			} else{
355 343
 				$logger->info('Cannot find helper [' . $function . '] from modules using the default location');
356 344
 			}
357 345
 			if(! $functionFilePath){
@@ -370,8 +358,7 @@  discard block
 block discarded – undo
370 358
 				require_once $functionFilePath;
371 359
 				static::$loaded['function_' . $function] = $functionFilePath;
372 360
 				$logger->info('Helper [' . $function . '] --> ' . $functionFilePath . ' loaded successfully.');
373
-			}
374
-			else{
361
+			} else{
375 362
 				show_error('Unable to find helper file [' . $file . ']');
376 363
 			}
377 364
 		}
@@ -414,8 +401,7 @@  discard block
 block discarded – undo
414 401
 			if($moduleConfigPath){
415 402
 				$logger->info('Found config [' . $filename . '] from module [' .$searchModuleName. '], the file path is [' .$moduleConfigPath. '] we will used it');
416 403
 				$configFilePath = $moduleConfigPath;
417
-			}
418
-			else{
404
+			} else{
419 405
 				$logger->info('Cannot find config [' . $filename . '] from modules using the default location');
420 406
 			}
421 407
 			$logger->info('The config file path to be loaded is [' . $configFilePath . ']');
@@ -424,8 +410,7 @@  discard block
 block discarded – undo
424 410
 				if(! empty($config) && is_array($config)){
425 411
 					Config::setAll($config);
426 412
 				}
427
-			}
428
-			else{
413
+			} else{
429 414
 				show_error('Unable to find config file ['. $configFilePath . ']');
430 415
 			}
431 416
 			static::$loaded['config_' . $filename] = $configFilePath;
@@ -483,8 +468,7 @@  discard block
 block discarded – undo
483 468
 			if($moduleLanguagePath){
484 469
 				$logger->info('Found language [' . $language . '] from module [' .$searchModuleName. '], the file path is [' .$moduleLanguagePath. '] we will used it');
485 470
 				$languageFilePath = $moduleLanguagePath;
486
-			}
487
-			else{
471
+			} else{
488 472
 				$logger->info('Cannot find language [' . $language . '] from modules using the default location');
489 473
 			}
490 474
 			if(! $languageFilePath){
@@ -511,8 +495,7 @@  discard block
 block discarded – undo
511 495
 				}
512 496
 				static::$loaded['lang_' . $language] = $languageFilePath;
513 497
 				$logger->info('Language [' . $language . '] --> ' . $languageFilePath . ' loaded successfully.');
514
-			}
515
-			else{
498
+			} else{
516 499
 				show_error('Unable to find language file [' . $file . ']');
517 500
 			}
518 501
 		}
Please login to merge, or discard this patch.
core/classes/EventDispatcher.php 1 patch
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -59,8 +59,7 @@  discard block
 block discarded – undo
59 59
 			if(! isset($this->listeners[$eventName])){
60 60
 				$this->logger->info('This event does not have the registered event listener before, adding new one');
61 61
 				$this->listeners[$eventName] = array();
62
-			}
63
-			else{
62
+			} else{
64 63
 				$this->logger->info('This event already have the registered listener, add this listener to the list');
65 64
 			}
66 65
 			$this->listeners[$eventName][] = $listener;
@@ -78,12 +77,10 @@  discard block
 block discarded – undo
78 77
 				if(false !== $index = array_search($listener, $this->listeners[$eventName], true)){
79 78
 					$this->logger->info('Found the listener at index [' .$index. '] remove it');
80 79
 					unset($this->listeners[$eventName][$index]);
81
-				}
82
-				else{
80
+				} else{
83 81
 					$this->logger->info('Cannot found this listener in the event listener list');
84 82
 				}
85
-			}
86
-			else{
83
+			} else{
87 84
 				$this->logger->info('This event does not have this listener ignore remove');
88 85
 			}
89 86
 		}
@@ -98,8 +95,7 @@  discard block
 block discarded – undo
98 95
 			if($eventName !== null && isset($this->listeners[$eventName])){
99 96
 				$this->logger->info('The event name is set of exist in the listener just remove all event listener for this event');
100 97
 				unset($this->listeners[$eventName]);
101
-			}
102
-			else{
98
+			} else{
103 99
 				$this->logger->info('The event name is not set or does not exist in the listener, so remove all event listener');
104 100
 				$this->listeners = array();
105 101
 			}
@@ -132,8 +128,7 @@  discard block
 block discarded – undo
132 128
 			if($event->returnBack){
133 129
 				$this->logger->info('This event need return back, return the result for future use');
134 130
 				return $this->dispatchToListerners($event);
135
-			}
136
-			else{
131
+			} else{
137 132
 				$this->logger->info('This event no need return back the result, just dispatch it');
138 133
 				$this->dispatchToListerners($event);
139 134
 			}
@@ -153,8 +148,7 @@  discard block
 block discarded – undo
153 148
 					return $event;
154 149
 				}
155 150
 				return;
156
-			}
157
-			else{
151
+			} else{
158 152
 				$this->logger->info('Found the registered event listener for the event [' .$event->name. '] the list are: ' . stringfy_vars($list));
159 153
 			}
160 154
 			foreach($list as $listener){
@@ -162,12 +156,10 @@  discard block
 block discarded – undo
162 156
 					$returnedEvent = call_user_func_array($listener, array($event));
163 157
 					if($returnedEvent instanceof EventInfo){
164 158
 						$event = $returnedEvent;
165
-					}
166
-					else{
159
+					} else{
167 160
 						show_error('This event [' .$event->name. '] need you return the event object after processing');
168 161
 					}
169
-				}
170
-				else{
162
+				} else{
171 163
 					call_user_func_array($listener, array($event));
172 164
 				}
173 165
 				if($event->stop){
Please login to merge, or discard this patch.
core/classes/Controller.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -115,8 +115,7 @@
 block discarded – undo
115 115
 		protected function setLoggerFromParamOrCreateNewInstance(Log $logger = null){
116 116
 			if($logger !== null){
117 117
 	          $this->logger = $logger;
118
-	        }
119
-	        else{
118
+	        } else{
120 119
 	            $this->logger =& class_loader('Log', 'classes');
121 120
 				$this->logger->setLogger('MainController');
122 121
 	        }
Please login to merge, or discard this patch.