@@ -28,10 +28,10 @@ discard block |
||
| 28 | 28 | $collection->addRoute('GET', '/path', 'myClass::myMethod', ['name']); |
| 29 | 29 | $collection->addRoute('GET', '/another', 'another-handler', ['name']); |
| 30 | 30 | |
| 31 | -$collection->group('/newPath', function () use ($collection, $something) { |
|
| 31 | +$collection->group('/newPath', function() use ($collection, $something) { |
|
| 32 | 32 | |
| 33 | 33 | //Add both POST and GET routes with Closure. |
| 34 | - $collection->addRoute(['GET', 'POST'], '/new', function ($request) use ($something) { |
|
| 34 | + $collection->addRoute(['GET', 'POST'], '/new', function($request) use ($something) { |
|
| 35 | 35 | return $something; |
| 36 | 36 | }, ['name']); |
| 37 | 37 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | $collection->addRoute('GET', '/mypath', 'handler::string', ['name']); |
| 41 | 41 | |
| 42 | -$collection->addRoute('GET', '/someproduct', function ($request) { |
|
| 42 | +$collection->addRoute('GET', '/someproduct', function($request) { |
|
| 43 | 43 | return 'this is my response for '; |
| 44 | 44 | }, ['name']); |
| 45 | 45 | |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | */ |
| 37 | 37 | public function testSerializeCalled() |
| 38 | 38 | { |
| 39 | - $data = function () { |
|
| 39 | + $data = function() { |
|
| 40 | 40 | return true; |
| 41 | 41 | }; |
| 42 | 42 | |
@@ -69,7 +69,7 @@ |
||
| 69 | 69 | */ |
| 70 | 70 | public function testGetRouterResponse() |
| 71 | 71 | { |
| 72 | - $request = $this->getMockBuilder(ServerRequestInterface::class)->getMock(); |
|
| 72 | + $request = $this->getMockBuilder(ServerRequestInterface::class)->getMock(); |
|
| 73 | 73 | |
| 74 | 74 | $method = 'GET'; |
| 75 | 75 | $path = '/path'; |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | { |
| 44 | 44 | $this->handler = 'handler'; |
| 45 | 45 | $this->code = 200; |
| 46 | - $this->names = ['name','name2']; |
|
| 46 | + $this->names = ['name', 'name2']; |
|
| 47 | 47 | $this->vars = ['a' => 1, 'b' =>2]; |
| 48 | 48 | $this->routerResponse = new RouterResponse($this->code, $this->handler, $this->names, $this->vars); |
| 49 | 49 | } |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | |
| 7 | 7 | $collection = new \Ds\Router\RouteCollection(); |
| 8 | 8 | |
| 9 | -$collection->addRoute('GET', '/pathalt', function () use ($variable) { |
|
| 9 | +$collection->addRoute('GET', '/pathalt', function() use ($variable) { |
|
| 10 | 10 | return $variable; |
| 11 | 11 | }, ['name']); |
| 12 | 12 | |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | |
| 7 | 7 | $collection = new \Ds\Router\RouteCollection(); |
| 8 | 8 | |
| 9 | -$collection->addRoute('GET', '/path', function () use ($variable) { |
|
| 9 | +$collection->addRoute('GET', '/path', function() use ($variable) { |
|
| 10 | 10 | return $variable; |
| 11 | 11 | }, ['name']); |
| 12 | 12 | |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | public function testWithNamespaces() |
| 34 | 34 | { |
| 35 | 35 | $namespaces = [ |
| 36 | - '\my\namespace','another','one\more' |
|
| 36 | + '\my\namespace', 'another', 'one\more' |
|
| 37 | 37 | ]; |
| 38 | 38 | |
| 39 | 39 | $expected = [ |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | /** |
| 36 | 36 | * @var array |
| 37 | 37 | */ |
| 38 | - protected $expectedNames = ['name-1','name-2']; |
|
| 38 | + protected $expectedNames = ['name-1', 'name-2']; |
|
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * Route setUp. |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function testWithNames() |
| 83 | 83 | { |
| 84 | - $expected = ['foo','bar','baz']; |
|
| 84 | + $expected = ['foo', 'bar', 'baz']; |
|
| 85 | 85 | $route = $this->route->withNames($expected); |
| 86 | 86 | $this->assertSame( |
| 87 | 87 | $expected, |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function testWithHandlerClosure() |
| 110 | 110 | { |
| 111 | - $expected = function () { |
|
| 111 | + $expected = function() { |
|
| 112 | 112 | return 'closure'; |
| 113 | 113 | }; |
| 114 | 114 | $route = $this->route->withHandler($expected); |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | public function testGetHandlerTypeClosure() |
| 154 | 154 | { |
| 155 | - $closure = function () { |
|
| 155 | + $closure = function() { |
|
| 156 | 156 | }; |
| 157 | 157 | $expected = 'object'; |
| 158 | 158 | $route = $this->route->withHandler($closure); |
@@ -231,8 +231,8 @@ discard block |
||
| 231 | 231 | |
| 232 | 232 | $route = \implode('', $this->group) . $routePattern; |
| 233 | 233 | |
| 234 | - if (substr($route, -1) === '/' && strlen($route) > 1){ |
|
| 235 | - $route = rtrim($route,'/'); |
|
| 234 | + if (substr($route, -1) === '/' && strlen($route) > 1) { |
|
| 235 | + $route = rtrim($route, '/'); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | return $route; |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | ) |
| 255 | 255 | ); |
| 256 | 256 | $new->collection[] = $addRoute; |
| 257 | - } catch (\Exception $e) { |
|
| 257 | + }catch (\Exception $e) { |
|
| 258 | 258 | if ($throw) { |
| 259 | 259 | throw new RouteException($e->getMessage()); |
| 260 | 260 | } |