Test Failed
Branch master (723c8d)
by Ch
03:54
created
AltoRouter.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 		$this->addRoutes($routes);
31 31
 		$this->setBasePath($basePath);
32 32
 		$this->addMatchTypes($matchTypes);
33
-		if(!$server) {
33
+		if (!$server) {
34 34
 			$this->server = $_SERVER;
35 35
 		}
36 36
 	}
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 		if (!is_array($routes) && !$routes instanceof Traversable) {
62 62
 			throw new Exception('Routes should be an array or an instance of Traversable');
63 63
 		}
64
-		if(!empty($routes)) {
64
+		if (!empty($routes)) {
65 65
 			foreach ($routes as $route) {
66 66
 				call_user_func_array(array($this, 'map'), $route);
67 67
 			}
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 
177 177
 			return array(
178 178
 				'target' => $handler[2],
179
-				'params' => array_filter($params, function ($k) { return !is_numeric($k); }, ARRAY_FILTER_USE_KEY),
179
+				'params' => array_filter($params, function($k) { return !is_numeric($k); }, ARRAY_FILTER_USE_KEY),
180 180
 				'name'   => $handler[3]
181 181
 			);
182 182
 		}
@@ -248,12 +248,12 @@  discard block
 block discarded – undo
248 248
 		$requestMethod = strtolower($requestMethod);
249 249
 		$methods = explode('|', $method);
250 250
 
251
-		if(in_array($requestMethod, $methods))
251
+		if (in_array($requestMethod, $methods))
252 252
 		{
253
-			if($routeString == '*') return true;
253
+			if ($routeString == '*') return true;
254 254
 
255
-			if(is_array($routeString) && !empty($routeString)) {
256
-				if($routeString[0] == '@') {
255
+			if (is_array($routeString) && !empty($routeString)) {
256
+				if ($routeString[0] == '@') {
257 257
 					return preg_match('`' . substr($routeString, 1) . '`u', $requestUrl, $params);
258 258
 				}
259 259
 				$regex = $this->compileRoute($routeString, $requestUrl);
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 				break;
283 283
 			}
284 284
 			if ($regex === false) {
285
-				if(!$this->getRouteRegexCheck($nPointer, $jPointer, $iPointer, $routeString, $requestUrl)) {
285
+				if (!$this->getRouteRegexCheck($nPointer, $jPointer, $iPointer, $routeString, $requestUrl)) {
286 286
 					continue;
287 287
 				}
288 288
 				$jPointer++;
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	{
298 298
 		$cPointer = $nPointer;
299 299
 		$regex = in_array($cPointer, array('[', '(', '.'));
300
-		if (!$regex && isset($routeString[$iPointer+1])) {
300
+		if (!$regex && isset($routeString[$iPointer + 1])) {
301 301
 			$nPointer = $routeString[$iPointer + 1];
302 302
 			$regex = in_array($nPointer, array('?', '+', '*', '{'));
303 303
 		}
@@ -309,8 +309,8 @@  discard block
 block discarded – undo
309 309
 
310 310
 	public function __call($method, $arguments)
311 311
 	{
312
-		if(!in_array($method, array('get', 'post', 'delete', 'put', 'patch', 'update', 'all'))) {
313
-			throw new Exception($method . ' not exist in the '. __CLASS__);
312
+		if (!in_array($method, array('get', 'post', 'delete', 'put', 'patch', 'update', 'all'))) {
313
+			throw new Exception($method . ' not exist in the ' . __CLASS__);
314 314
 		}
315 315
 
316 316
 		$methods = $method == 'all' ? implode('|', $this->all) : $method;
Please login to merge, or discard this patch.