@@ -316,7 +316,7 @@ |
||
316 | 316 | $name = trim($pattern, '/'); |
317 | 317 | } |
318 | 318 | |
319 | - $this->group($pattern, function (Router $router) use ($handler, $maps, $name, $attributes) { |
|
319 | + $this->group($pattern, function(Router $router) use ($handler, $maps, $name, $attributes) { |
|
320 | 320 | foreach ($maps as $map) { |
321 | 321 | if ($map['many']) { |
322 | 322 | /** @var Route $route */ |
@@ -53,8 +53,7 @@ discard block |
||
53 | 53 | use Platine\Http\UriInterface; |
54 | 54 | use Platine\Route\Exception\RouteNotFoundException; |
55 | 55 | |
56 | -class Router |
|
57 | -{ |
|
56 | +class Router { |
|
58 | 57 | /** |
59 | 58 | * The current route group prefix |
60 | 59 | * @var string |
@@ -77,8 +76,7 @@ discard block |
||
77 | 76 | * Create new Router instance |
78 | 77 | * @param RouteCollectionInterface|null $routes |
79 | 78 | */ |
80 | - public function __construct(?RouteCollectionInterface $routes = null) |
|
81 | - { |
|
79 | + public function __construct(?RouteCollectionInterface $routes = null) { |
|
82 | 80 | $this->routes = $routes ? $routes : new RouteCollection(); |
83 | 81 | } |
84 | 82 |
@@ -54,8 +54,7 @@ discard block |
||
54 | 54 | use Platine\Http\UriInterface; |
55 | 55 | use Platine\Route\Exception\InvalidRouteParameterException; |
56 | 56 | |
57 | -class Route |
|
58 | -{ |
|
57 | +class Route { |
|
59 | 58 | /** |
60 | 59 | * Search through the given route looking for dynamic portions. |
61 | 60 | * |
@@ -176,8 +175,7 @@ discard block |
||
176 | 175 | * @param string $name |
177 | 176 | * @return mixed|null |
178 | 177 | */ |
179 | - public function getAttribute(string $name) |
|
180 | - { |
|
178 | + public function getAttribute(string $name) { |
|
181 | 179 | return $this->attributes[$name] ?? null; |
182 | 180 | } |
183 | 181 | |
@@ -242,8 +240,7 @@ discard block |
||
242 | 240 | * Return the route handler |
243 | 241 | * @return mixed |
244 | 242 | */ |
245 | - public function getHandler() |
|
246 | - { |
|
243 | + public function getHandler() { |
|
247 | 244 | return $this->handler; |
248 | 245 | } |
249 | 246 |
@@ -50,8 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | use InvalidArgumentException; |
52 | 52 | |
53 | -class ParameterCollection |
|
54 | -{ |
|
53 | +class ParameterCollection { |
|
55 | 54 | /** |
56 | 55 | * The array of parameters |
57 | 56 | * @var array<string, ParameterInterface> |
@@ -69,8 +68,7 @@ discard block |
||
69 | 68 | * |
70 | 69 | * @param ParameterInterface[] $parameters the route parameters |
71 | 70 | */ |
72 | - public function __construct(array $parameters = []) |
|
73 | - { |
|
71 | + public function __construct(array $parameters = []) { |
|
74 | 72 | foreach ($parameters as $parameter) { |
75 | 73 | if (!$parameter instanceof ParameterInterface) { |
76 | 74 | throw new InvalidArgumentException(sprintf( |
@@ -52,8 +52,7 @@ discard block |
||
52 | 52 | use Platine\Route\Exception\RouteAlreadyExistsException; |
53 | 53 | use Platine\Route\Exception\RouteNotFoundException; |
54 | 54 | |
55 | -class RouteCollection implements RouteCollectionInterface |
|
56 | -{ |
|
55 | +class RouteCollection implements RouteCollectionInterface { |
|
57 | 56 | /** |
58 | 57 | * The list of routes |
59 | 58 | * @var Route[] |
@@ -70,8 +69,7 @@ discard block |
||
70 | 69 | * Create new instance |
71 | 70 | * @param Route[] $routes |
72 | 71 | */ |
73 | - public function __construct(array $routes = []) |
|
74 | - { |
|
72 | + public function __construct(array $routes = []) { |
|
75 | 73 | foreach ($routes as $route) { |
76 | 74 | if (!$route instanceof Route) { |
77 | 75 | throw new InvalidArgumentException(sprintf( |
@@ -48,8 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | namespace Platine\Route; |
50 | 50 | |
51 | -class Parameter implements ParameterInterface |
|
52 | -{ |
|
51 | +class Parameter implements ParameterInterface { |
|
53 | 52 | /** |
54 | 53 | * The parameter name |
55 | 54 | * @var string |
@@ -68,8 +67,7 @@ discard block |
||
68 | 67 | * @param string $name the name of the parameter |
69 | 68 | * @param mixed $value the parameter value |
70 | 69 | */ |
71 | - public function __construct(string $name, $value) |
|
72 | - { |
|
70 | + public function __construct(string $name, $value) { |
|
73 | 71 | $this->name = $name; |
74 | 72 | $this->value = $value; |
75 | 73 | } |
@@ -85,8 +83,7 @@ discard block |
||
85 | 83 | /** |
86 | 84 | * {@inheritdoc} |
87 | 85 | */ |
88 | - public function getValue() |
|
89 | - { |
|
86 | + public function getValue() { |
|
90 | 87 | return $this->value; |
91 | 88 | } |
92 | 89 |
@@ -48,8 +48,7 @@ |
||
48 | 48 | |
49 | 49 | namespace Platine\Route; |
50 | 50 | |
51 | -interface ParameterInterface |
|
52 | -{ |
|
51 | +interface ParameterInterface { |
|
53 | 52 | /** |
54 | 53 | * Return the name of the parameter |
55 | 54 | * |
@@ -51,8 +51,7 @@ |
||
51 | 51 | use Platine\Route\Exception\RouteAlreadyExistsException; |
52 | 52 | use Platine\Route\Exception\RouteNotFoundException; |
53 | 53 | |
54 | -interface RouteCollectionInterface |
|
55 | -{ |
|
54 | +interface RouteCollectionInterface { |
|
56 | 55 | /** |
57 | 56 | * Add new route |
58 | 57 | * |