| @@ -69,7 +69,7 @@ discard block | ||
| 69 | 69 | |
| 70 | 70 | /** | 
| 71 | 71 | * Get route (early) middleware pre-response. | 
| 72 | - * @return mixed | |
| 72 | + * @return string | |
| 73 | 73 | */ | 
| 74 | 74 |      public function getPreResponse(){ | 
| 75 | 75 | return $this->preResponse; | 
| @@ -77,7 +77,7 @@ discard block | ||
| 77 | 77 | |
| 78 | 78 | /** | 
| 79 | 79 | * Set handler pre-response. | 
| 80 | - * @param $string | |
| 80 | + * @param string $string | |
| 81 | 81 | * @return $this | 
| 82 | 82 | */ | 
| 83 | 83 |      public function withPreResponse($string){ | 
| @@ -56,7 +56,7 @@ | ||
| 56 | 56 | * @param $name | 
| 57 | 57 | */ | 
| 58 | 58 |      public function addName($name = ''){ | 
| 59 | - $this->name[$name] = $name; | |
| 59 | + $this->name[$name] = $name; | |
| 60 | 60 | } | 
| 61 | 61 | |
| 62 | 62 | /** | 
| @@ -47,7 +47,7 @@ discard block | ||
| 47 | 47 | * Set Route name; | 
| 48 | 48 | * @param $name | 
| 49 | 49 | */ | 
| 50 | -    public function setName(array $name = []){ | |
| 50 | +    public function setName(array $name = []) { | |
| 51 | 51 | $this->name = $name; | 
| 52 | 52 | } | 
| 53 | 53 | |
| @@ -55,7 +55,7 @@ discard block | ||
| 55 | 55 | * Add Route name; | 
| 56 | 56 | * @param $name | 
| 57 | 57 | */ | 
| 58 | -    public function addName($name = ''){ | |
| 58 | +    public function addName($name = '') { | |
| 59 | 59 | $this->name[$name] = $name; | 
| 60 | 60 | } | 
| 61 | 61 | |
| @@ -63,7 +63,7 @@ discard block | ||
| 63 | 63 | * Get all added names | 
| 64 | 64 | * @return mixed | 
| 65 | 65 | */ | 
| 66 | -    public function getNames(){ | |
| 66 | +    public function getNames() { | |
| 67 | 67 | return (array)$this->name; | 
| 68 | 68 | } | 
| 69 | 69 | |
| @@ -71,7 +71,7 @@ discard block | ||
| 71 | 71 | * Get route (early) middleware pre-response. | 
| 72 | 72 | * @return mixed | 
| 73 | 73 | */ | 
| 74 | -    public function getPreResponse(){ | |
| 74 | +    public function getPreResponse() { | |
| 75 | 75 | return $this->preResponse; | 
| 76 | 76 | } | 
| 77 | 77 | |
| @@ -80,7 +80,7 @@ discard block | ||
| 80 | 80 | * @param $string | 
| 81 | 81 | * @return $this | 
| 82 | 82 | */ | 
| 83 | -    public function withPreResponse($string){ | |
| 83 | +    public function withPreResponse($string) { | |
| 84 | 84 | |
| 85 | 85 | $new = clone $this; | 
| 86 | 86 | $new->preResponse = $string; | 
| @@ -98,7 +98,7 @@ discard block | ||
| 98 | 98 |      public static function __set_state($fields) { | 
| 99 | 99 | |
| 100 | 100 | $args = []; | 
| 101 | -        foreach($fields as $key => $value){ | |
| 101 | +        foreach ($fields as $key => $value) { | |
| 102 | 102 | $args[] = $value; | 
| 103 | 103 | } | 
| 104 | 104 | |
| @@ -5,7 +5,7 @@ discard block | ||
| 5 | 5 | use Ds\Router\Adaptor\FastRoute; | 
| 6 | 6 | use Ds\Router\Handler\Handler; | 
| 7 | 7 | |
| 8 | -class MockHandler extends Handler{ | |
| 8 | +class MockHandler extends Handler { | |
| 9 | 9 | |
| 10 | 10 | function getResponse($vars = []) | 
| 11 | 11 |      { | 
| @@ -22,7 +22,7 @@ discard block | ||
| 22 | 22 | public $fastRoute; | 
| 23 | 23 | public $options; | 
| 24 | 24 | |
| 25 | -    public function setUp(){ | |
| 25 | +    public function setUp() { | |
| 26 | 26 | |
| 27 | 27 | $this->options = [ | 
| 28 | 28 | 'handler' => '\Tests\Ds\Router\Adaptor\MockHandler', | 
| @@ -41,22 +41,22 @@ discard block | ||
| 41 | 41 | $this->fastRoute = new FastRoute($this->options); | 
| 42 | 42 | } | 
| 43 | 43 | |
| 44 | -    public function testFindHandler(){ | |
| 44 | +    public function testFindHandler() { | |
| 45 | 45 |          $result = $this->fastRoute->findHandler('default'); | 
| 46 | 46 |          $this->assertInstanceOf('\Tests\Ds\Router\Adaptor\MockHandler', $result); | 
| 47 | 47 | } | 
| 48 | 48 | |
| 49 | -    public function testFindHandlerDefault(){ | |
| 49 | +    public function testFindHandlerDefault() { | |
| 50 | 50 |          $result = $this->fastRoute->findHandler('notFound'); | 
| 51 | 51 |          $this->assertInstanceOf('\Tests\Ds\Router\Adaptor\MockHandler', $result); | 
| 52 | 52 | } | 
| 53 | 53 | |
| 54 | -    public function testCheckCacheFileDisabled(){ | |
| 54 | +    public function testCheckCacheFileDisabled() { | |
| 55 | 55 | $expected = true; | 
| 56 | 56 | $actual = $this->fastRoute->checkCacheFile(); | 
| 57 | 57 | $this->assertEquals($expected, $actual); | 
| 58 | 58 | } | 
| 59 | 59 | |
| 60 | -    public function testGetCachedDispatcher(){} | |
| 61 | -    public function testMatch(){} | |
| 60 | +    public function testGetCachedDispatcher() {} | |
| 61 | +    public function testMatch() {} | |
| 62 | 62 | } | 
| 63 | 63 | \ No newline at end of file | 
| @@ -4,7 +4,7 @@ discard block | ||
| 4 | 4 | |
| 5 | 5 | use Ds\Router\Handler\ClassHandler; | 
| 6 | 6 | |
| 7 | -class TestController{ | |
| 7 | +class TestController { | |
| 8 | 8 | |
| 9 | 9 | public $resolveValue; | 
| 10 | 10 | |
| @@ -13,8 +13,8 @@ discard block | ||
| 13 | 13 | $this->resolveValue = $resolveValue; | 
| 14 | 14 | } | 
| 15 | 15 | |
| 16 | -    public function test($var){ | |
| 17 | - return 'foo'.$var; | |
| 16 | +    public function test($var) { | |
| 17 | + return 'foo' . $var; | |
| 18 | 18 | } | 
| 19 | 19 | } | 
| 20 | 20 | |
| @@ -29,44 +29,44 @@ discard block | ||
| 29 | 29 | $this->controller = 'Tests\Ds\Router\Handler\TestController'; | 
| 30 | 30 | } | 
| 31 | 31 | |
| 32 | -    public function testConstructController(){ | |
| 33 | - $reflector = new \ReflectionClass( $this->handler); | |
| 34 | - $prop = $reflector->getProperty( 'controller' ); | |
| 32 | +    public function testConstructController() { | |
| 33 | + $reflector = new \ReflectionClass($this->handler); | |
| 34 | +        $prop = $reflector->getProperty('controller'); | |
| 35 | 35 | $prop->setAccessible(true); | 
| 36 | 36 | $this->assertEquals($this->controller, $prop->getValue($this->handler)); | 
| 37 | 37 | } | 
| 38 | 38 | |
| 39 | -    public function testConstructMethod(){ | |
| 40 | - $reflector = new \ReflectionClass( $this->handler); | |
| 41 | - $prop = $reflector->getProperty( 'method' ); | |
| 39 | +    public function testConstructMethod() { | |
| 40 | + $reflector = new \ReflectionClass($this->handler); | |
| 41 | +        $prop = $reflector->getProperty('method'); | |
| 42 | 42 | $prop->setAccessible(true); | 
| 43 | 43 |          $this->assertEquals('test', $prop->getValue($this->handler)); | 
| 44 | 44 | } | 
| 45 | 45 | |
| 46 | -    public function testConstructPreResponse(){ | |
| 47 | - $reflector = new \ReflectionClass( $this->handler); | |
| 48 | - $prop = $reflector->getProperty( 'preResponse' ); | |
| 46 | +    public function testConstructPreResponse() { | |
| 47 | + $reflector = new \ReflectionClass($this->handler); | |
| 48 | +        $prop = $reflector->getProperty('preResponse'); | |
| 49 | 49 | $prop->setAccessible(true); | 
| 50 | - $this->assertEquals($this->controller.'::test', $prop->getValue($this->handler)); | |
| 50 | + $this->assertEquals($this->controller . '::test', $prop->getValue($this->handler)); | |
| 51 | 51 | } | 
| 52 | 52 | |
| 53 | -    public function testResolveClassInstance(){ | |
| 53 | +    public function testResolveClassInstance() { | |
| 54 | 54 | $handler = $this->handler->resolve(); | 
| 55 | 55 | $reflector = new \ReflectionClass($handler); | 
| 56 | - $prop = $reflector->getProperty( 'resolved' ); | |
| 56 | +        $prop = $reflector->getProperty('resolved'); | |
| 57 | 57 | $prop->setAccessible(true); | 
| 58 | 58 | $this->assertInstanceOf($this->controller, $prop->getValue($handler)); | 
| 59 | 59 | } | 
| 60 | 60 | |
| 61 | 61 | |
| 62 | -    public function testGetResponse(){ | |
| 62 | +    public function testGetResponse() { | |
| 63 | 63 | $expected = 'foobar'; | 
| 64 | 64 | $this->handler->resolve(); | 
| 65 | 65 |          $actual = $this->handler->getResponse('bar'); | 
| 66 | 66 | $this->assertEquals($expected, $actual); | 
| 67 | 67 | } | 
| 68 | 68 | |
| 69 | -    public function testGetResponseException(){ | |
| 69 | +    public function testGetResponseException() { | |
| 70 | 70 |          $this->setExpectedException('Exception'); | 
| 71 | 71 |          $this->handler->getResponse('bar'); | 
| 72 | 72 | } | 
| @@ -10,7 +10,7 @@ discard block | ||
| 10 | 10 | |
| 11 | 11 | use Ds\Router\Handler\Handler; | 
| 12 | 12 | |
| 13 | -class TestHandler extends Handler{ | |
| 13 | +class TestHandler extends Handler { | |
| 14 | 14 | |
| 15 | 15 | public $preResponse = 'pre-response'; | 
| 16 | 16 | public $name = ['foo' => 'foo']; | 
| @@ -44,7 +44,7 @@ discard block | ||
| 44 | 44 | $this->handler = new TestHandler(); | 
| 45 | 45 | } | 
| 46 | 46 | |
| 47 | -    public function testSetName(){ | |
| 47 | +    public function testSetName() { | |
| 48 | 48 | $expected = ['bar']; | 
| 49 | 49 | $this->handler->setName($expected); | 
| 50 | 50 | |
| @@ -53,20 +53,20 @@ discard block | ||
| 53 | 53 | $reflectionProperty->setAccessible(true); | 
| 54 | 54 | $actual = $reflectionProperty->getValue($this->handler); | 
| 55 | 55 | |
| 56 | - $this->assertEquals($expected,$actual); | |
| 56 | + $this->assertEquals($expected, $actual); | |
| 57 | 57 | } | 
| 58 | 58 | |
| 59 | -    public function testAddName(){ | |
| 59 | +    public function testAddName() { | |
| 60 | 60 | $expected = 'foo'; | 
| 61 | 61 | $this->handler->addName($expected); | 
| 62 | 62 |          $reflectionClass = new \ReflectionClass('Tests\Ds\Router\Handler\TestHandler'); | 
| 63 | 63 |          $reflectionProperty = $reflectionClass->getProperty('name'); | 
| 64 | 64 | $reflectionProperty->setAccessible(true); | 
| 65 | 65 | $actual = $reflectionProperty->getValue($this->handler); | 
| 66 | - $this->assertEquals([$expected => $expected],$actual); | |
| 66 | + $this->assertEquals([$expected => $expected], $actual); | |
| 67 | 67 | } | 
| 68 | 68 | |
| 69 | -    public function testGetNames(){ | |
| 69 | +    public function testGetNames() { | |
| 70 | 70 | $expected = [ | 
| 71 | 71 | 'foo' => 'foo', | 
| 72 | 72 | ]; | 
| @@ -74,7 +74,7 @@ discard block | ||
| 74 | 74 | $this->assertEquals($expected, $this->handler->getNames()); | 
| 75 | 75 | } | 
| 76 | 76 | |
| 77 | -    public function testWithPreResponse(){ | |
| 77 | +    public function testWithPreResponse() { | |
| 78 | 78 | |
| 79 | 79 | $expected = 'preResponse String'; | 
| 80 | 80 | $this->handler = $this->handler->withPreResponse($expected); | 
| @@ -89,13 +89,13 @@ discard block | ||
| 89 | 89 | } | 
| 90 | 90 | |
| 91 | 91 | |
| 92 | -    public function testGetPreResponse(){ | |
| 92 | +    public function testGetPreResponse() { | |
| 93 | 93 | $expected = 'preResponse String'; | 
| 94 | 94 | $this->handler = $this->handler->withPreResponse($expected); | 
| 95 | 95 | $this->assertEquals($expected, $this->handler->getPreResponse()); | 
| 96 | 96 | } | 
| 97 | 97 | |
| 98 | -    public function testSetState(){ | |
| 98 | +    public function testSetState() { | |
| 99 | 99 | $actual = TestHandler::__set_state(['state' => 'newState']); | 
| 100 | 100 |          $expected = new TestHandler('newState'); | 
| 101 | 101 | $this->assertEquals($expected, $actual); | 
| @@ -24,13 +24,13 @@ discard block | ||
| 24 | 24 | ); | 
| 25 | 25 | } | 
| 26 | 26 | |
| 27 | -    public function testGetHandler(){ | |
| 27 | +    public function testGetHandler() { | |
| 28 | 28 | $handler = $this->response->getHandler(); | 
| 29 | 29 |          $this->assertInstanceOf('\Ds\Router\Interfaces\RouteHandlerInterface', $handler); | 
| 30 | 30 | $this->assertSame($this->handler, $handler); | 
| 31 | 31 | } | 
| 32 | 32 | |
| 33 | -    public function testWithHandler(){ | |
| 33 | +    public function testWithHandler() { | |
| 34 | 34 | |
| 35 | 35 |          $newHandler = $this->getMockBuilder('\Ds\Router\Interfaces\RouteHandlerInterface')->getMock(); | 
| 36 | 36 | $oldHandler = $this->response->getHandler(); | 
| @@ -42,11 +42,11 @@ discard block | ||
| 42 | 42 | * Returns the Status Code. | 
| 43 | 43 | * @return int | 
| 44 | 44 | */ | 
| 45 | -    public function testGetStatusCode(){ | |
| 46 | - $this->assertEquals( $this->response->getStatusCode(), 200); | |
| 45 | +    public function testGetStatusCode() { | |
| 46 | + $this->assertEquals($this->response->getStatusCode(), 200); | |
| 47 | 47 | } | 
| 48 | 48 | |
| 49 | -    public function testGetResponseInstance(){ | |
| 49 | +    public function testGetResponseInstance() { | |
| 50 | 50 | |
| 51 | 51 |          $httpResponse = $this->getMockBuilder('\Psr\Http\Message\ResponseInterface')->getMock(); | 
| 52 | 52 | |
| @@ -54,7 +54,7 @@ discard block | ||
| 54 | 54 |              ->method('getResponse') | 
| 55 | 55 | ->willReturn($httpResponse); | 
| 56 | 56 | |
| 57 | - $response = new RouterResponse( 200, ['get'], $this->handler, []); | |
| 57 | + $response = new RouterResponse(200, ['get'], $this->handler, []); | |
| 58 | 58 | $psrResponse = $response->getResponse(); | 
| 59 | 59 | |
| 60 | 60 |          $this->assertInstanceOf('\Psr\Http\Message\ResponseInterface', $psrResponse); | 
| @@ -114,10 +114,10 @@ | ||
| 114 | 114 | return \FastRoute\cachedDispatcher( | 
| 115 | 115 |              function(RouteCollector $r) use ($routes){ | 
| 116 | 116 |                  foreach($routes as $route){ | 
| 117 | - $r->addRoute($route['method'],$route['pattern'],$route['handler']); | |
| 117 | + $r->addRoute($route['method'],$route['pattern'],$route['handler']); | |
| 118 | 118 | } | 
| 119 | 119 | }, | 
| 120 | - $this->options | |
| 120 | + $this->options | |
| 121 | 121 | ); | 
| 122 | 122 | } | 
| 123 | 123 | |
| @@ -15,7 +15,7 @@ discard block | ||
| 15 | 15 | $this->options = $options; | 
| 16 | 16 | $this->checkCacheFile(); | 
| 17 | 17 | |
| 18 | -        if (!isset($this->options['errorHandlers']['default'])){ | |
| 18 | +        if (!isset($this->options['errorHandlers']['default'])) { | |
| 19 | 19 |              throw new \Exception('Error Handlers must be specified'); | 
| 20 | 20 | } | 
| 21 | 21 | |
| @@ -27,7 +27,7 @@ discard block | ||
| 27 | 27 | * Check cache file and update self::$cacheDisabled | 
| 28 | 28 | * @return bool | 
| 29 | 29 | */ | 
| 30 | -    public function checkCacheFile(){ | |
| 30 | +    public function checkCacheFile() { | |
| 31 | 31 | $cacheDir = isset($this->options['cacheFile']) | 
| 32 | 32 | ? $this->options['cacheFile'] : __DIR__; | 
| 33 | 33 | |
| @@ -48,7 +48,7 @@ discard block | ||
| 48 | 48 | * @param string $requestTarget | 
| 49 | 49 | * @return RouterResponse | 
| 50 | 50 | */ | 
| 51 | -    public function match(array $routes, $method, $requestTarget){ | |
| 51 | +    public function match(array $routes, $method, $requestTarget) { | |
| 52 | 52 | |
| 53 | 53 | $response = [ | 
| 54 | 54 | 'statusCode' => 500, | 
| @@ -56,7 +56,7 @@ discard block | ||
| 56 | 56 | 'vars' => [] | 
| 57 | 57 | ]; | 
| 58 | 58 | |
| 59 | - $routeInfo = $this->getCachedDispatcher($routes)->dispatch($method, $requestTarget); | |
| 59 | + $routeInfo = $this->getCachedDispatcher($routes)->dispatch($method, $requestTarget); | |
| 60 | 60 | |
| 61 | 61 |          switch ($routeInfo[0]) { | 
| 62 | 62 | case Dispatcher::FOUND: | 
| @@ -91,10 +91,10 @@ discard block | ||
| 91 | 91 | * @param $code | 
| 92 | 92 | * @return mixed | 
| 93 | 93 | */ | 
| 94 | -    public function findHandler($code){ | |
| 94 | +    public function findHandler($code) { | |
| 95 | 95 | $handlerName = $this->options['handler']; | 
| 96 | 96 | $handlerArgs = $this->options['errorHandlers']['default']; | 
| 97 | -        if (isset($this->options['errorHandlers'][$code])){ | |
| 97 | +        if (isset($this->options['errorHandlers'][$code])) { | |
| 98 | 98 | $handlerArgs = $this->options['errorHandlers'][$code]; | 
| 99 | 99 | } | 
| 100 | 100 | |
| @@ -109,12 +109,12 @@ discard block | ||
| 109 | 109 | * @param array $routes | 
| 110 | 110 | * @return FastRouteAdaptor | 
| 111 | 111 | */ | 
| 112 | -    public function getCachedDispatcher(array $routes = []){ | |
| 112 | +    public function getCachedDispatcher(array $routes = []) { | |
| 113 | 113 | |
| 114 | 114 | return \FastRoute\cachedDispatcher( | 
| 115 | 115 |              function(RouteCollector $r) use ($routes){ | 
| 116 | -                foreach($routes as $route){ | |
| 117 | - $r->addRoute($route['method'],$route['pattern'],$route['handler']); | |
| 116 | +                foreach ($routes as $route) { | |
| 117 | + $r->addRoute($route['method'], $route['pattern'], $route['handler']); | |
| 118 | 118 | } | 
| 119 | 119 | }, | 
| 120 | 120 | $this->options | 
| @@ -36,7 +36,7 @@ discard block | ||
| 36 | 36 | * Return Adaptor Options | 
| 37 | 37 | * @return array | 
| 38 | 38 | */ | 
| 39 | -    public function getOptions(){ | |
| 39 | +    public function getOptions() { | |
| 40 | 40 | return $this->options; | 
| 41 | 41 | } | 
| 42 | 42 | |
| @@ -45,7 +45,7 @@ discard block | ||
| 45 | 45 | * @param array $options | 
| 46 | 46 | * @return void | 
| 47 | 47 | */ | 
| 48 | -    public function withOptions(array $options = []){ | |
| 48 | +    public function withOptions(array $options = []) { | |
| 49 | 49 | $this->options = $options; | 
| 50 | 50 | return; | 
| 51 | 51 | } | 
| @@ -53,7 +53,7 @@ | ||
| 53 | 53 |          try{ | 
| 54 | 54 | $this->resolveController( $this->controller); | 
| 55 | 55 | $this->resolveMethod( $this->method ); | 
| 56 | -        }catch(\Exception $e){ | |
| 56 | +        } catch(\Exception $e){ | |
| 57 | 57 | $this->resolved = new $this->controller(...$arguments); | 
| 58 | 58 | } | 
| 59 | 59 | |
| @@ -24,7 +24,7 @@ discard block | ||
| 24 | 24 | * @param string $method | 
| 25 | 25 | * @return ClassHandler | 
| 26 | 26 | */ | 
| 27 | -    public static function add($controller, $method){ | |
| 27 | +    public static function add($controller, $method) { | |
| 28 | 28 | return new ClassHandler($controller, $method); | 
| 29 | 29 | } | 
| 30 | 30 | |
| @@ -51,19 +51,19 @@ discard block | ||
| 51 | 51 | * @return $this | 
| 52 | 52 | * @throws \Exception | 
| 53 | 53 | */ | 
| 54 | -    public function resolve(...$arguments){ | |
| 54 | +    public function resolve(...$arguments) { | |
| 55 | 55 | |
| 56 | 56 | |
| 57 | -        $controllerMethod = explode('::',$this->getPreResponse()); | |
| 57 | +        $controllerMethod = explode('::', $this->getPreResponse()); | |
| 58 | 58 | |
| 59 | 59 | $this->controller = isset($controllerMethod[0]) ? $controllerMethod[0] : $this->controller; | 
| 60 | 60 | $this->method = isset($controllerMethod[1]) ? $controllerMethod[1] : $this->method; | 
| 61 | 61 | |
| 62 | -        try{ | |
| 63 | - $this->resolveController( $this->controller); | |
| 64 | - $this->resolveMethod( $this->method ); | |
| 62 | +        try { | |
| 63 | + $this->resolveController($this->controller); | |
| 64 | + $this->resolveMethod($this->method); | |
| 65 | 65 | $this->resolved = new $this->controller(...$arguments); | 
| 66 | -        }catch(\Exception $e){ | |
| 66 | +        }catch (\Exception $e) { | |
| 67 | 67 | throw new \Exception($e->getMessage()); | 
| 68 | 68 | } | 
| 69 | 69 | return $this; | 
| @@ -77,9 +77,9 @@ discard block | ||
| 77 | 77 | * @return ResponseInterface | 
| 78 | 78 | * @throws \Exception | 
| 79 | 79 | */ | 
| 80 | -    public function getResponse($vars = [] ){ | |
| 80 | +    public function getResponse($vars = []) { | |
| 81 | 81 | |
| 82 | -        if ($this->resolved === null){ | |
| 82 | +        if ($this->resolved === null) { | |
| 83 | 83 |              throw new \Exception("Handler must be resolved before calling getContents()."); | 
| 84 | 84 | } | 
| 85 | 85 | |
| @@ -96,9 +96,9 @@ discard block | ||
| 96 | 96 | * @return bool | 
| 97 | 97 |       * @throws \Exception controller:{controller} not found | 
| 98 | 98 | */ | 
| 99 | -    private function resolveController($controller){ | |
| 99 | +    private function resolveController($controller) { | |
| 100 | 100 | |
| 101 | -        if ( !class_exists($controller)){ | |
| 101 | +        if (!class_exists($controller)) { | |
| 102 | 102 |              throw new \Exception("Controller {$controller} not found"); | 
| 103 | 103 | } | 
| 104 | 104 | return true; | 
| @@ -111,8 +111,8 @@ discard block | ||
| 111 | 111 | * @return bool | 
| 112 | 112 | * @throws \Exception | 
| 113 | 113 | */ | 
| 114 | -    private function resolveMethod($method){ | |
| 115 | -        if (method_exists($this->controller,$method)){ | |
| 114 | +    private function resolveMethod($method) { | |
| 115 | +        if (method_exists($this->controller, $method)) { | |
| 116 | 116 | return true; | 
| 117 | 117 | } | 
| 118 | 118 |          throw new \Exception("method: {$this->controller}::{$method} not found"); | 
| @@ -49,12 +49,12 @@ | ||
| 49 | 49 |      { | 
| 50 | 50 | |
| 51 | 51 | $pattern = ltrim($pattern, '/'); | 
| 52 | - $pattern = '/'.$pattern; | |
| 52 | + $pattern = '/' . $pattern; | |
| 53 | 53 | |
| 54 | -        if ($this->groupedRoute === false){ | |
| 54 | +        if ($this->groupedRoute === false) { | |
| 55 | 55 | $routePattern = $pattern; | 
| 56 | -        }else{ | |
| 57 | -            $routePattern = implode('',$this->dir).$pattern; | |
| 56 | +        } else { | |
| 57 | +            $routePattern = implode('', $this->dir) . $pattern; | |
| 58 | 58 | } | 
| 59 | 59 | |
| 60 | 60 | $this->isUnique($method, $routePattern); | 
| @@ -53,7 +53,7 @@ | ||
| 53 | 53 | |
| 54 | 54 |          if ($this->groupedRoute === false){ | 
| 55 | 55 | $routePattern = $pattern; | 
| 56 | -        }else{ | |
| 56 | +        } else{ | |
| 57 | 57 |              $routePattern = implode('',$this->dir).$pattern; | 
| 58 | 58 | } | 
| 59 | 59 | |