@@ -26,7 +26,7 @@ |
||
| 26 | 26 | /* Return current action route */ |
| 27 | 27 | $action = Router::currentAction(); |
| 28 | 28 | |
| 29 | -}catch(Exception $er){ |
|
| 29 | +} catch(Exception $er){ |
|
| 30 | 30 | |
| 31 | 31 | die("Code Error: {$er->getCode()}, Line: {$er->getLine()}, File: {$er->getFile()}, Message: {$er->getMessage()}."); |
| 32 | 32 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | self::getInstance()->checkMethod($route, $_SERVER['REQUEST_METHOD']); |
| 80 | 80 | self::getInstance()->checkData($route, (new Uri($_SERVER['REQUEST_URI']))->getPath()); |
| 81 | 81 | return self::getInstance(); |
| 82 | - }catch(\Exception $er){ |
|
| 82 | + } catch(\Exception $er){ |
|
| 83 | 83 | continue; |
| 84 | 84 | } |
| 85 | 85 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | try{ |
| 100 | 100 | self::getInstance()->executeRouteAction(); |
| 101 | - }catch(\Exception $er){ |
|
| 101 | + } catch(\Exception $er){ |
|
| 102 | 102 | self::getInstance()->error = $er; |
| 103 | 103 | } |
| 104 | 104 | |
@@ -8,8 +8,8 @@ |
||
| 8 | 8 | use Psr\Http\Server\RequestHandlerInterface; |
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | - * @property string $error |
|
| 12 | - */ |
|
| 11 | + * @property string $error |
|
| 12 | + */ |
|
| 13 | 13 | class Lasted extends Middleware{ |
| 14 | 14 | |
| 15 | 15 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
@@ -7,8 +7,8 @@ |
||
| 7 | 7 | use Psr\Http\Server\RequestHandlerInterface; |
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | - * @property string $error |
|
| 11 | - */ |
|
| 10 | + * @property string $error |
|
| 11 | + */ |
|
| 12 | 12 | class Auth extends Middleware{ |
| 13 | 13 | |
| 14 | 14 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
@@ -64,9 +64,9 @@ discard block |
||
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | $routes[$index] = [ |
| 67 | - 'uri' => new Uri(self::getInstance()->getHost().self::getInstance()->getPrefix().$uri), |
|
| 68 | - 'action' => $closure, |
|
| 69 | - 'method' => strtoupper($method), |
|
| 67 | + 'uri' => new Uri(self::getInstance()->getHost().self::getInstance()->getPrefix().$uri), |
|
| 68 | + 'action' => $closure, |
|
| 69 | + 'method' => strtoupper($method), |
|
| 70 | 70 | 'middlewares' => [], |
| 71 | 71 | 'where' => null, |
| 72 | 72 | 'before' => [], |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | private static function checkDuplicity(string $uri, string $method): void |
| 84 | 84 | { |
| 85 | 85 | foreach(self::getInstance()->getRoutes() as $route){ |
| 86 | - if( md5($route['uri'].$route['method']) === md5($uri.$method) ){ |
|
| 86 | + if( md5($route['uri'].$route['method']) === md5($uri.$method) ){ |
|
| 87 | 87 | throw new \RuntimeException("There is already a route with the URI {$uri} and with the {$method} METHOD configured."); |
| 88 | 88 | } |
| 89 | 89 | } |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | |
| 35 | 35 | |
| 36 | 36 | Router::get('/6my-accounttttt/{param1}/{param2}','HnrAzevedo\Router\Example\Controllers\User@requireLogin') |
| 37 | - ->middleware([HnrAzevedo\Router\Example\Middleware\Auth::class,'Lasted']); |
|
| 37 | + ->middleware([HnrAzevedo\Router\Example\Middleware\Auth::class,'Lasted']); |
|
| 38 | 38 | |
| 39 | 39 | Router::get('/7my-account/{:teste}','Controller\\User:my_account')->where([ |
| 40 | 40 | 'teste'=>'[a-zA-Z]{1,10}' |