@@ -52,16 +52,14 @@ |
||
| 52 | 52 | * @class Parameter |
| 53 | 53 | * @package Platine\Route |
| 54 | 54 | */ |
| 55 | -class Parameter implements ParameterInterface |
|
| 56 | -{ |
|
| 55 | +class Parameter implements ParameterInterface { |
|
| 57 | 56 | /** |
| 58 | 57 | * Create new parameter |
| 59 | 58 | * |
| 60 | 59 | * @param string $name the name of the parameter |
| 61 | 60 | * @param mixed $value the parameter value |
| 62 | 61 | */ |
| 63 | - public function __construct(protected string $name, protected mixed $value) |
|
| 64 | - { |
|
| 62 | + public function __construct(protected string $name, protected mixed $value) { |
|
| 65 | 63 | } |
| 66 | 64 | |
| 67 | 65 | /** |
@@ -52,8 +52,7 @@ |
||
| 52 | 52 | * @class ParameterInterface |
| 53 | 53 | * @package Platine\Route |
| 54 | 54 | */ |
| 55 | -interface ParameterInterface |
|
| 56 | -{ |
|
| 55 | +interface ParameterInterface { |
|
| 57 | 56 | /** |
| 58 | 57 | * Return the name of the parameter |
| 59 | 58 | * |
@@ -54,8 +54,7 @@ discard block |
||
| 54 | 54 | * @class ParameterCollection |
| 55 | 55 | * @package Platine\Route |
| 56 | 56 | */ |
| 57 | -class ParameterCollection |
|
| 58 | -{ |
|
| 57 | +class ParameterCollection { |
|
| 59 | 58 | /** |
| 60 | 59 | * The array of parameters |
| 61 | 60 | * @var array<string, ParameterInterface> |
@@ -73,8 +72,7 @@ discard block |
||
| 73 | 72 | * |
| 74 | 73 | * @param ParameterInterface[] $parameters the route parameters |
| 75 | 74 | */ |
| 76 | - public function __construct(array $parameters = []) |
|
| 77 | - { |
|
| 75 | + public function __construct(array $parameters = []) { |
|
| 78 | 76 | foreach ($parameters as $parameter) { |
| 79 | 77 | if (!$parameter instanceof ParameterInterface) { |
| 80 | 78 | throw new InvalidArgumentException(sprintf( |
@@ -40,6 +40,5 @@ |
||
| 40 | 40 | * @class RouteNotFoundException |
| 41 | 41 | * @package Platine\Route\Exception |
| 42 | 42 | */ |
| 43 | -class RouteNotFoundException extends Exception |
|
| 44 | -{ |
|
| 43 | +class RouteNotFoundException extends Exception { |
|
| 45 | 44 | } |
@@ -40,6 +40,5 @@ |
||
| 40 | 40 | * @class InvalidRouteParameterException |
| 41 | 41 | * @package Platine\Route\Exception |
| 42 | 42 | */ |
| 43 | -class InvalidRouteParameterException extends Exception |
|
| 44 | -{ |
|
| 43 | +class InvalidRouteParameterException extends Exception { |
|
| 45 | 44 | } |
@@ -40,6 +40,5 @@ |
||
| 40 | 40 | * @class RouteAlreadyExistsException |
| 41 | 41 | * @package Platine\Route\Exception |
| 42 | 42 | */ |
| 43 | -class RouteAlreadyExistsException extends Exception |
|
| 44 | -{ |
|
| 43 | +class RouteAlreadyExistsException extends Exception { |
|
| 45 | 44 | } |
@@ -55,8 +55,7 @@ |
||
| 55 | 55 | * @class RouteCollectionInterface |
| 56 | 56 | * @package Platine\Route |
| 57 | 57 | */ |
| 58 | -interface RouteCollectionInterface |
|
| 59 | -{ |
|
| 58 | +interface RouteCollectionInterface { |
|
| 60 | 59 | /** |
| 61 | 60 | * Add new route |
| 62 | 61 | * |
@@ -56,8 +56,7 @@ discard block |
||
| 56 | 56 | * @class RouteCollection |
| 57 | 57 | * @package Platine\Route |
| 58 | 58 | */ |
| 59 | -class RouteCollection implements RouteCollectionInterface |
|
| 60 | -{ |
|
| 59 | +class RouteCollection implements RouteCollectionInterface { |
|
| 61 | 60 | /** |
| 62 | 61 | * The list of routes |
| 63 | 62 | * @var Route[] |
@@ -74,8 +73,7 @@ discard block |
||
| 74 | 73 | * Create new instance |
| 75 | 74 | * @param Route[] $routes |
| 76 | 75 | */ |
| 77 | - public function __construct(array $routes = []) |
|
| 78 | - { |
|
| 76 | + public function __construct(array $routes = []) { |
|
| 79 | 77 | foreach ($routes as $route) { |
| 80 | 78 | if (!$route instanceof Route) { |
| 81 | 79 | throw new InvalidArgumentException(sprintf( |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | public function add( |
| 141 | 141 | string $pattern, |
| 142 | 142 | mixed $handler, |
| 143 | - array|string $methods, |
|
| 143 | + array | string $methods, |
|
| 144 | 144 | string $name = '', |
| 145 | 145 | array $attributes = [] |
| 146 | 146 | ): Route { |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | $name = trim($pattern, '/'); |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | - $this->group($pattern, function (Router $router) use ($handler, $maps, $name, $attributes) { |
|
| 433 | + $this->group($pattern, function(Router $router) use ($handler, $maps, $name, $attributes) { |
|
| 434 | 434 | foreach ($maps as $map) { |
| 435 | 435 | if ($map['many']) { |
| 436 | 436 | /** @var Route $route */ |
@@ -57,8 +57,7 @@ discard block |
||
| 57 | 57 | * @class Router |
| 58 | 58 | * @package Platine\Route |
| 59 | 59 | */ |
| 60 | -class Router |
|
| 61 | -{ |
|
| 60 | +class Router { |
|
| 62 | 61 | /** |
| 63 | 62 | * The current route group prefix |
| 64 | 63 | * @var string |
@@ -81,8 +80,7 @@ discard block |
||
| 81 | 80 | * Create new Router instance |
| 82 | 81 | * @param RouteCollectionInterface|null $routes |
| 83 | 82 | */ |
| 84 | - public function __construct(?RouteCollectionInterface $routes = null) |
|
| 85 | - { |
|
| 83 | + public function __construct(?RouteCollectionInterface $routes = null) { |
|
| 86 | 84 | $this->routes = $routes ?? new RouteCollection(); |
| 87 | 85 | } |
| 88 | 86 | |