Completed
Push — master ( 016764...50d24f )
by judicael
04:08
created
bundles/core/Router.php 1 patch
Braces   +26 added lines, -52 removed lines patch added patch discarded remove patch
@@ -131,14 +131,12 @@  discard block
 block discarded – undo
131 131
     		            
132 132
     		            echo file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.$_SERVER['REQUEST_URI']);
133 133
                         exit;
134
-    		        }
135
-                    else if (strstr($_SERVER['REQUEST_URI'], '.css')
134
+    		        } else if (strstr($_SERVER['REQUEST_URI'], '.css')
136 135
 		                && file_exists(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.preg_replace('/\.css/', '.less', $_SERVER['REQUEST_URI']))) {
137 136
 
138 137
 		                Less::toCss(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.preg_replace('/\.css/', '.less', $_SERVER['REQUEST_URI']));
139 138
 		                exit;
140
-                    }
141
-		            else if (strstr($_SERVER['REQUEST_URI'], '.js')
139
+                    } else if (strstr($_SERVER['REQUEST_URI'], '.js')
142 140
 		                && file_exists(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.preg_replace('/\.js/', '.ts', $_SERVER['REQUEST_URI']))) {
143 141
 
144 142
 		                Typescript::toJs(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.preg_replace('/\.js/', '.ts', $_SERVER['REQUEST_URI']));
@@ -167,8 +165,7 @@  discard block
 block discarded – undo
167 165
     						header('Status: 301 Moved Permanently', false, 301);
168 166
     	  					header('Location: '.$oHost->location);
169 167
     	  					exit;
170
-    					}
171
-    					else if (preg_match('#getCss\?#', $_SERVER['REQUEST_URI'])) {
168
+    					} else if (preg_match('#getCss\?#', $_SERVER['REQUEST_URI'])) {
172 169
     					    
173 170
     					    foreach ($_GET as $sKey => $sValue) {
174 171
 
@@ -179,8 +176,7 @@  discard block
 block discarded – undo
179 176
     					    }
180 177
     					    
181 178
     					    exit;
182
-    					}
183
-    					else if (preg_match('#getJs\?#', $_SERVER['REQUEST_URI'])) {
179
+    					} else if (preg_match('#getJs\?#', $_SERVER['REQUEST_URI'])) {
184 180
     					    
185 181
     					    foreach ($_GET as $sKey => $sValue) {
186 182
 
@@ -191,8 +187,7 @@  discard block
 block discarded – undo
191 187
     					    }
192 188
     					    
193 189
     					    exit;
194
-    					}
195
-    					else if (isset($oHost->routes)) {
190
+    					} else if (isset($oHost->routes)) {
196 191
     
197 192
     						foreach($oHost->routes as $sKey => $oRoute) {
198 193
 
@@ -201,8 +196,7 @@  discard block
 block discarded – undo
201 196
     							if ($mReturn === 403) {
202 197
     
203 198
     								$this->_getPage403();
204
-    							}
205
-    							else if ($mReturn === true) {
199
+    							} else if ($mReturn === true) {
206 200
     
207 201
     								if (isset($oRoute->cache)) { $this->_checkCache($oRoute->cache); }
208 202
     
@@ -215,11 +209,9 @@  discard block
 block discarded – undo
215 209
     				}
216 210
 			    }
217 211
 			}
218
-		}
219
-        else if (Request::isCliRequest()) {
212
+		} else if (Request::isCliRequest()) {
220 213
 
221
-			if (isset($_SERVER['argv'])) { $aArguments = $_SERVER['argv']; }
222
-			else { $aArguments = $argv; }
214
+			if (isset($_SERVER['argv'])) { $aArguments = $_SERVER['argv']; } else { $aArguments = $argv; }
223 215
 
224 216
 			define('PORTAL', 'Batch');
225 217
 			set_include_path(get_include_path().PATH_SEPARATOR.'src'.PATH_SEPARATOR.PORTAL.PATH_SEPARATOR.'public');
@@ -229,8 +221,7 @@  discard block
 block discarded – undo
229 221
                 $sBatchName = "phpunit";
230 222
                 $aArguments[0] = "bin/console";
231 223
                 $aArguments[1] = "phpunit";
232
-            }
233
-            else {
224
+            } else {
234 225
                 $sBatchName = $aArguments[1];
235 226
             }
236 227
 
@@ -279,8 +270,7 @@  discard block
 block discarded – undo
279 270
 			if (isset($oBatch->controller) && isset($oBatch->action)) {
280 271
 
281 272
 				echo $this->_loadController($oBatch->controller, $oBatch->action, array($aOptions));
282
-			}
283
-			else {
273
+			} else {
284 274
 
285 275
 				if (Request::isCliRequest()) {
286 276
 
@@ -323,8 +313,7 @@  discard block
 block discarded – undo
323 313
 					}
324 314
 				}
325 315
 			}
326
-		}
327
-		else if (defined('STDIN')) {
316
+		} else if (defined('STDIN')) {
328 317
 
329 318
 			$oBatch = Config::get('Route')->batch->script->{$sRoute};
330 319
 			echo $this->_loadController($oBatch->controller, $oBatch->action, $aParams);
@@ -386,8 +375,7 @@  discard block
 block discarded – undo
386 375
 				},
387 376
 				$sRoute
388 377
 			);
389
-		}
390
-		else {
378
+		} else {
391 379
 
392 380
 			$sFinalRoute = '.*';
393 381
 		}
@@ -437,8 +425,7 @@  discard block
 block discarded – undo
437 425
 
438 426
 				$oMobileDetect = new \Mobile_Detect;
439 427
 
440
-				if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; }
441
-				else { $sCacheExt = ''; }
428
+				if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; } else { $sCacheExt = ''; }
442 429
 
443 430
 				$mCacheReturn = Cache::get($RequestUri.$sCacheExt, $oRoute->cache->max_age);
444 431
 
@@ -461,17 +448,14 @@  discard block
 block discarded – undo
461 448
 					if ($oRoute->content_type == 'json') {
462 449
 
463 450
 						header('Content-type: application/json; charset='.$sCharset.'');
464
-					}
465
-					else if ($oRoute->content_type == 'html') {
451
+					} else if ($oRoute->content_type == 'html') {
466 452
 
467 453
 						header('Content-type: text/html; charset='.$sCharset.'');
468
-					}
469
-					else if ($oRoute->content_type == 'jpeg') {
454
+					} else if ($oRoute->content_type == 'jpeg') {
470 455
 
471 456
 						header('Content-type: image/jpeg');
472 457
 					}
473
-				}
474
-				else {
458
+				} else {
475 459
 
476 460
 					header('Content-type: text/html; charset='.$sCharset.'');
477 461
 				}
@@ -492,21 +476,17 @@  discard block
 block discarded – undo
492 476
 						if (isset($_GET[$sName]) && $_GET[$sName] != '') {
493 477
 
494 478
 							$aEntries[] = $_GET[$sName];
495
-						}
496
-						else if (isset($oRoute->defaults_constraints) && is_object($oRoute->defaults_constraints)
479
+						} else if (isset($oRoute->defaults_constraints) && is_object($oRoute->defaults_constraints)
497 480
 							&& isset($oRoute->defaults_constraints->{$sName})) {
498 481
 
499 482
 							$aEntries[] = $oRoute->defaults_constraints->{$sName};
500
-						}
501
-						else if (isset($_GET[$sName])) {
483
+						} else if (isset($_GET[$sName])) {
502 484
 
503 485
 							$aEntries[] = $_GET[$sName];
504
-						}
505
-						else if (preg_match('/'.$sType.'/', '')) {
486
+						} else if (preg_match('/'.$sType.'/', '')) {
506 487
 
507 488
 							$aEntries[] = '';
508
-						}
509
-						else {
489
+						} else {
510 490
 
511 491
 						    $this->_oLogger->warning('Error: Parameter '.$sName.' not exists!');
512 492
 							break;
@@ -518,8 +498,7 @@  discard block
 block discarded – undo
518 498
 						$mReturn = $this->_loadController($oController, $sActionName, $aEntries);
519 499
 
520 500
 					}
521
-				}
522
-				else {
501
+				} else {
523 502
 
524 503
 					$mReturn = $this->_loadController($oController, $sActionName, $aEntries);
525 504
 				}
@@ -531,8 +510,7 @@  discard block
 block discarded – undo
531 510
 						$mReturn = json_encode($mReturn, JSON_PRETTY_PRINT);
532 511
 					}
533 512
 				}
534
-			}
535
-			else if (isset($oRoute->template) && isset($oRoute->layout) && $oRoute->layout === true) {
513
+			} else if (isset($oRoute->template) && isset($oRoute->layout) && $oRoute->layout === true) {
536 514
 
537 515
 			    define('PORTAL', preg_replace('/^\\\\Venus\\\\src\\\\([a-zA-Z0-9_]+)\\\\.+$/', '$1', $oRoute->template));
538 516
 			    set_include_path(get_include_path().PATH_SEPARATOR.'src'.PATH_SEPARATOR.PORTAL.PATH_SEPARATOR.'public');
@@ -549,8 +527,7 @@  discard block
 block discarded – undo
549 527
 
550 528
 				$mReturn = $oLayout->assign('model', DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.PORTAL.DIRECTORY_SEPARATOR.'View'.DIRECTORY_SEPARATOR.$oRoute->template.'.tpl')
551 529
 								   ->fetch();
552
-			}
553
-			else if (isset($oRoute->template)) {
530
+			} else if (isset($oRoute->template)) {
554 531
 
555 532
 			    define('PORTAL', preg_replace('/^\\\\Venus\\\\src\\\\([a-zA-Z0-9_]+)\\\\.+$/', '$1', $oRoute->template));
556 533
 			    set_include_path(get_include_path().PATH_SEPARATOR.'src'.PATH_SEPARATOR.PORTAL.PATH_SEPARATOR.'public');
@@ -574,8 +551,7 @@  discard block
 block discarded – undo
574 551
 
575 552
 				$oMobileDetect = new \Mobile_Detect;
576 553
 
577
-				if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; }
578
-				else { $sCacheExt = ''; }
554
+				if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; } else { $sCacheExt = ''; }
579 555
 
580 556
 				if (defined('COMPRESS_HTML') && COMPRESS_HTML) {
581 557
 
@@ -629,8 +605,7 @@  discard block
 block discarded – undo
629 605
 
630 606
 			$oMobileDetect = new \Mobile_Detect;
631 607
 
632
-			if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; }
633
-			else { $sCacheExt = ''; }
608
+			if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; } else { $sCacheExt = ''; }
634 609
 
635 610
 			$mCacheReturn = Cache::get($sActionName.$sCacheExt, $aPhpDoc['Cache']['maxage']);
636 611
 
@@ -671,8 +646,7 @@  discard block
 block discarded – undo
671 646
 
672 647
 			$oMobileDetect = new \Mobile_Detect;
673 648
 
674
-			if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; }
675
-			else { $sCacheExt = ''; }
649
+			if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; } else { $sCacheExt = ''; }
676 650
 
677 651
 			if (defined('COMPRESS_HTML') && COMPRESS_HTML) {
678 652
 
Please login to merge, or discard this patch.
bundles/lib/Cache/File.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -85,8 +85,7 @@  discard block
 block discarded – undo
85 85
 		if (file_exists($this->_sFolder.$this->_getSubDirectory($sName).md5($sName).'.fil.cac')) {
86 86
 
87 87
 			return unserialize(file_get_contents($this->_sFolder.$this->_getSubDirectory($sName).md5($sName).'.fil.cac'));
88
-		}
89
-		else {
88
+		} else {
90 89
 
91 90
 			return false;
92 91
 		}
@@ -146,8 +145,7 @@  discard block
 block discarded – undo
146 145
 
147 146
 			while (($sFile = readdir($rDirectory)) !== false) {
148 147
 
149
-				if ($sFile > '0' && filetype($sName.$sFile) == "file") { unlink($sName.$sFile); }
150
-				elseif ($sFile > '0' && filetype($sName.$sFile) == "dir") { remove_dir($sName.$sFile."\\"); }
148
+				if ($sFile > '0' && filetype($sName.$sFile) == "file") { unlink($sName.$sFile); } elseif ($sFile > '0' && filetype($sName.$sFile) == "dir") { remove_dir($sName.$sFile."\\"); }
151 149
 			}
152 150
 
153 151
 			closedir($rDirectory);
Please login to merge, or discard this patch.
bundles/lib/Request/Files.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,7 @@
 block discarded – undo
19 19
     {
20 20
         if (isset($_FILES[$name]) && $_FILES[$name] != '') {
21 21
             return $_FILES[$name];
22
-        }
23
-        else if ($default !== null) {
22
+        } else if ($default !== null) {
24 23
             return $default;
25 24
         }
26 25
     }
Please login to merge, or discard this patch.
bundles/lib/Request/Server.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,7 @@
 block discarded – undo
19 19
     {
20 20
         if (isset($_SERVER[$name]) && $_SERVER[$name] != '') {
21 21
             return $_SERVER[$name];
22
-        }
23
-        else if ($default !== null) {
22
+        } else if ($default !== null) {
24 23
             return $default;
25 24
         }
26 25
     }
Please login to merge, or discard this patch.
bundles/lib/Request/Request.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,7 @@
 block discarded – undo
19 19
     {
20 20
         if (isset($_POST[$name]) && $_POST[$name] != '') {
21 21
             return $_POST[$name];
22
-        }
23
-        else if ($default !== null) {
22
+        } else if ($default !== null) {
24 23
             return $default;
25 24
         }
26 25
     }
Please login to merge, or discard this patch.
bundles/lib/Request/Query.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,7 @@
 block discarded – undo
19 19
     {
20 20
         if (isset($_GET[$name]) && $_GET[$name] != '') {
21 21
             return $_GET[$name];
22
-        }
23
-        else if ($default !== null) {
22
+        } else if ($default !== null) {
24 23
             return $default;
25 24
         }
26 25
     }
Please login to merge, or discard this patch.
bundles/lib/Request/Cookies.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,7 @@
 block discarded – undo
19 19
     {
20 20
         if (isset($_COOKIE[$name]) && $_COOKIE[$name] != '') {
21 21
             return $_COOKIE[$name];
22
-        }
23
-        else if ($default !== null) {
22
+        } else if ($default !== null) {
24 23
             return $default;
25 24
         }
26 25
     }
Please login to merge, or discard this patch.
bundles/lib/Request/Headers.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,8 +19,7 @@  discard block
 block discarded – undo
19 19
     {
20 20
         if (isset(apache_request_headers()[$name]) && apache_request_headers()[$name] != '') {
21 21
             return apache_request_headers()[$name];
22
-        }
23
-        else if ($default !== null) {
22
+        } else if ($default !== null) {
24 23
             return $default;
25 24
         }
26 25
     }
@@ -35,8 +34,7 @@  discard block
 block discarded – undo
35 34
     {
36 35
         if ($value !== null) {
37 36
             header($name . ': ' . $value);
38
-        }
39
-        else {
37
+        } else {
40 38
             header($name);
41 39
         }
42 40
         
Please login to merge, or discard this patch.