@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace Ds\Router\Handler; |
4 | 4 | |
5 | 5 | use Ds\Router\RouteHandlerInterface; |
6 | -use Psr\Http\Message\ResponseInterface; |
|
7 | 6 | |
8 | 7 | /** |
9 | 8 | * Closure Route Handler. |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @param callable $closure |
22 | 22 | * @return Closure |
23 | 23 | */ |
24 | - public static function add($preResponse = '', callable $closure){ |
|
24 | + public static function add($preResponse = '', callable $closure) { |
|
25 | 25 | return new Closure($preResponse, $closure); |
26 | 26 | } |
27 | 27 | |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | */ |
44 | 44 | function getResponse($vars = []) |
45 | 45 | { |
46 | - if ($this->resolved === null){ |
|
46 | + if ($this->resolved === null) { |
|
47 | 47 | throw new \Exception("Handler must be resolved before calling getContents()."); |
48 | 48 | } |
49 | - return call_user_func($this->closure,$vars); |
|
49 | + return call_user_func($this->closure, $vars); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -44,45 +44,45 @@ |
||
44 | 44 | ); |
45 | 45 | } |
46 | 46 | |
47 | - public function testGetAdaptor(){ |
|
47 | + public function testGetAdaptor() { |
|
48 | 48 | $expected = $this->adaptor; |
49 | 49 | $actual = $this->router->getAdaptor(); |
50 | 50 | $this->assertEquals($expected, $actual); |
51 | 51 | } |
52 | 52 | |
53 | - public function testWithAdaptor(){ |
|
53 | + public function testWithAdaptor() { |
|
54 | 54 | $newAdaptor = $this->getMockBuilder('\Ds\Router\AdaptorInterface')->getMock(); |
55 | 55 | $newRouter = $this->router->withAdaptor($newAdaptor); |
56 | 56 | $this->assertNotSame($this->adaptor, $newRouter->getAdaptor()); |
57 | 57 | } |
58 | 58 | |
59 | - public function testGetRouterResponse(){ |
|
59 | + public function testGetRouterResponse() { |
|
60 | 60 | |
61 | 61 | $request = $this->getMockBuilder('\Psr\Http\Message\RequestInterface')->getMock(); |
62 | 62 | |
63 | - $routerResponse = new RouterResponse(200,[],null,[]); |
|
63 | + $routerResponse = new RouterResponse(200, [], null, []); |
|
64 | 64 | |
65 | - $this->adaptor->expects( $this->once() ) |
|
65 | + $this->adaptor->expects($this->once()) |
|
66 | 66 | ->method('match') |
67 | 67 | ->willReturn($routerResponse); |
68 | 68 | |
69 | - $this->routes->expects( $this->once() ) |
|
69 | + $this->routes->expects($this->once()) |
|
70 | 70 | ->method('getRoutes') |
71 | 71 | ->willReturn([]); |
72 | 72 | |
73 | 73 | $response = $this->router->getRouterResponse($request); |
74 | - $this->assertInstanceOf('\Ds\Router\RouterResponseInterface' , $response); |
|
74 | + $this->assertInstanceOf('\Ds\Router\RouterResponseInterface', $response); |
|
75 | 75 | |
76 | 76 | } |
77 | 77 | |
78 | - public function testWithRoutes(){ |
|
78 | + public function testWithRoutes() { |
|
79 | 79 | |
80 | 80 | $routes = $this->getMockBuilder('\Ds\Router\RoutesInterface')->getMock(); |
81 | 81 | $this->router->withRoutes($routes); |
82 | 82 | |
83 | - $reflector = new \ReflectionClass( '\Ds\Router\Router' ); |
|
84 | - $prop = $reflector->getProperty( 'routes' ); |
|
85 | - $prop->setAccessible( true ); |
|
83 | + $reflector = new \ReflectionClass('\Ds\Router\Router'); |
|
84 | + $prop = $reflector->getProperty('routes'); |
|
85 | + $prop->setAccessible(true); |
|
86 | 86 | |
87 | 87 | $this->assertSame($routes, $prop->getValue($this->router)); |
88 | 88 |