@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | protected $default; |
| 131 | 131 | |
| 132 | - public function __construct( string $key ) { |
|
| 132 | + public function __construct(string $key) { |
|
| 133 | 133 | $this->key = $key; |
| 134 | 134 | } |
| 135 | 135 | |
@@ -140,10 +140,10 @@ discard block |
||
| 140 | 140 | * @param callable $config |
| 141 | 141 | * @return self |
| 142 | 142 | */ |
| 143 | - public static function on( string $key, ?callable $config = null ): self { |
|
| 144 | - $argument = new self( $key ); |
|
| 143 | + public static function on(string $key, ?callable $config = null): self { |
|
| 144 | + $argument = new self($key); |
|
| 145 | 145 | return $config |
| 146 | - ? $config( $argument ) |
|
| 146 | + ? $config($argument) |
|
| 147 | 147 | : $argument; |
| 148 | 148 | } |
| 149 | 149 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | * |
| 173 | 173 | * @return self |
| 174 | 174 | */ |
| 175 | - public function validation( callable $validation ): self { |
|
| 175 | + public function validation(callable $validation): self { |
|
| 176 | 176 | $this->validation = $validation; |
| 177 | 177 | return $this; |
| 178 | 178 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | * |
| 195 | 195 | * @return self |
| 196 | 196 | */ |
| 197 | - public function sanitization( callable $sanitization ): self { |
|
| 197 | + public function sanitization(callable $sanitization): self { |
|
| 198 | 198 | $this->sanitization = $sanitization; |
| 199 | 199 | return $this; |
| 200 | 200 | } |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | * @return bool |
| 215 | 215 | */ |
| 216 | 216 | public function has_default(): bool { |
| 217 | - return ! is_null( $this->default ); |
|
| 217 | + return ! is_null($this->default); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | * @param string|int|float|bool $default The default value |
| 224 | 224 | * @return self |
| 225 | 225 | */ |
| 226 | - public function default( $default ): self { |
|
| 226 | + public function default($default): self { |
|
| 227 | 227 | $this->default = $default; |
| 228 | 228 | return $this; |
| 229 | 229 | } |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | * @param bool $required Is this argument required |
| 253 | 253 | * @return self |
| 254 | 254 | */ |
| 255 | - public function required( bool $required = true ): self { |
|
| 255 | + public function required(bool $required = true): self { |
|
| 256 | 256 | $this->required = $required; |
| 257 | 257 | return $this; |
| 258 | 258 | } |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | * |
| 274 | 274 | * @return self |
| 275 | 275 | */ |
| 276 | - public function type( string $type ): self { |
|
| 276 | + public function type(string $type): self { |
|
| 277 | 277 | $this->type = $type; |
| 278 | 278 | return $this; |
| 279 | 279 | } |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | * @param string $description The argument description. |
| 294 | 294 | * @return self |
| 295 | 295 | */ |
| 296 | - public function description( string $description ): self { |
|
| 296 | + public function description(string $description): self { |
|
| 297 | 297 | $this->description = $description; |
| 298 | 298 | return $this; |
| 299 | 299 | } |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | * @param string $format Optional format to expect value. |
| 314 | 314 | * @return self |
| 315 | 315 | */ |
| 316 | - public function format( string $format ): self { |
|
| 316 | + public function format(string $format): self { |
|
| 317 | 317 | $this->format = $format; |
| 318 | 318 | return $this; |
| 319 | 319 | } |
@@ -333,8 +333,8 @@ discard block |
||
| 333 | 333 | * @param mixed ...$expected Accept value for argument. |
| 334 | 334 | * @return self |
| 335 | 335 | */ |
| 336 | - public function expected( ...$expected ): self { |
|
| 337 | - $this->expected = array_merge( $this->expected ?? array(), $expected ); |
|
| 336 | + public function expected(...$expected): self { |
|
| 337 | + $this->expected = array_merge($this->expected ?? array(), $expected); |
|
| 338 | 338 | return $this; |
| 339 | 339 | } |
| 340 | 340 | |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | * |
| 356 | 356 | * @return self |
| 357 | 357 | */ |
| 358 | - public function minimum( $minimum ): self { |
|
| 358 | + public function minimum($minimum): self { |
|
| 359 | 359 | $this->minimum = $minimum; |
| 360 | 360 | return $this; |
| 361 | 361 | } |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | * |
| 377 | 377 | * @return self |
| 378 | 378 | */ |
| 379 | - public function maximum( $maximum ): self { |
|
| 379 | + public function maximum($maximum): self { |
|
| 380 | 380 | $this->maximum = $maximum; |
| 381 | 381 | return $this; |
| 382 | 382 | } |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | * @param bool $exclusive_minimum Should the minimum range exclude the value set |
| 397 | 397 | * @return self |
| 398 | 398 | */ |
| 399 | - public function exclusive_minimum( bool $exclusive_minimum = true ): self { |
|
| 399 | + public function exclusive_minimum(bool $exclusive_minimum = true): self { |
|
| 400 | 400 | $this->exclusive_minimum = $exclusive_minimum; |
| 401 | 401 | return $this; |
| 402 | 402 | } |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | * @param bool $exclusive_maximum Should the maximum range exclude the value set |
| 417 | 417 | * @return self |
| 418 | 418 | */ |
| 419 | - public function exclusive_maximum( bool $exclusive_maximum = true ): self { |
|
| 419 | + public function exclusive_maximum(bool $exclusive_maximum = true): self { |
|
| 420 | 420 | $this->exclusive_maximum = $exclusive_maximum; |
| 421 | 421 | return $this; |
| 422 | 422 | } |
@@ -35,10 +35,10 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | protected $route; |
| 37 | 37 | |
| 38 | - public function __construct( string $namespace, string $route ) { |
|
| 38 | + public function __construct(string $namespace, string $route) { |
|
| 39 | 39 | $this->route = $route; |
| 40 | 40 | $this->namespace = $namespace; |
| 41 | - $this->route_factory = new Route_Factory( $namespace ); |
|
| 41 | + $this->route_factory = new Route_Factory($namespace); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -56,10 +56,10 @@ discard block |
||
| 56 | 56 | * @param callable $callable |
| 57 | 57 | * @return Route |
| 58 | 58 | */ |
| 59 | - public function get( callable $callable ): Route { |
|
| 60 | - $route = $this->route_factory->get( $this->route, $callable ); |
|
| 61 | - $route->namespace( $this->namespace ); |
|
| 62 | - $this->routes[ Route::GET ] = $route; |
|
| 59 | + public function get(callable $callable): Route { |
|
| 60 | + $route = $this->route_factory->get($this->route, $callable); |
|
| 61 | + $route->namespace($this->namespace); |
|
| 62 | + $this->routes[Route::GET] = $route; |
|
| 63 | 63 | return $route; |
| 64 | 64 | } |
| 65 | 65 | |
@@ -69,10 +69,10 @@ discard block |
||
| 69 | 69 | * @param callable $callable |
| 70 | 70 | * @return Route |
| 71 | 71 | */ |
| 72 | - public function post( callable $callable ): Route { |
|
| 73 | - $route = $this->route_factory->post( $this->route, $callable ); |
|
| 74 | - $route->namespace( $this->namespace ); |
|
| 75 | - $this->routes[ Route::POST ] = $route; |
|
| 72 | + public function post(callable $callable): Route { |
|
| 73 | + $route = $this->route_factory->post($this->route, $callable); |
|
| 74 | + $route->namespace($this->namespace); |
|
| 75 | + $this->routes[Route::POST] = $route; |
|
| 76 | 76 | return $route; |
| 77 | 77 | } |
| 78 | 78 | |
@@ -82,10 +82,10 @@ discard block |
||
| 82 | 82 | * @param callable $callable |
| 83 | 83 | * @return Route |
| 84 | 84 | */ |
| 85 | - public function put( callable $callable ): Route { |
|
| 86 | - $route = $this->route_factory->put( $this->route, $callable ); |
|
| 87 | - $route->namespace( $this->namespace ); |
|
| 88 | - $this->routes[ Route::PUT ] = $route; |
|
| 85 | + public function put(callable $callable): Route { |
|
| 86 | + $route = $this->route_factory->put($this->route, $callable); |
|
| 87 | + $route->namespace($this->namespace); |
|
| 88 | + $this->routes[Route::PUT] = $route; |
|
| 89 | 89 | return $route; |
| 90 | 90 | } |
| 91 | 91 | |
@@ -95,10 +95,10 @@ discard block |
||
| 95 | 95 | * @param callable $callable |
| 96 | 96 | * @return Route |
| 97 | 97 | */ |
| 98 | - public function patch( callable $callable ): Route { |
|
| 99 | - $route = $this->route_factory->patch( $this->route, $callable ); |
|
| 100 | - $route->namespace( $this->namespace ); |
|
| 101 | - $this->routes[ Route::PATCH ] = $route; |
|
| 98 | + public function patch(callable $callable): Route { |
|
| 99 | + $route = $this->route_factory->patch($this->route, $callable); |
|
| 100 | + $route->namespace($this->namespace); |
|
| 101 | + $this->routes[Route::PATCH] = $route; |
|
| 102 | 102 | return $route; |
| 103 | 103 | } |
| 104 | 104 | |
@@ -108,10 +108,10 @@ discard block |
||
| 108 | 108 | * @param callable $callable |
| 109 | 109 | * @return Route |
| 110 | 110 | */ |
| 111 | - public function delete( callable $callable ): Route { |
|
| 112 | - $route = $this->route_factory->delete( $this->route, $callable ); |
|
| 113 | - $route->namespace( $this->namespace ); |
|
| 114 | - $this->routes[ Route::DELETE ] = $route; |
|
| 111 | + public function delete(callable $callable): Route { |
|
| 112 | + $route = $this->route_factory->delete($this->route, $callable); |
|
| 113 | + $route->namespace($this->namespace); |
|
| 114 | + $this->routes[Route::DELETE] = $route; |
|
| 115 | 115 | return $route; |
| 116 | 116 | } |
| 117 | 117 | |
@@ -122,8 +122,8 @@ discard block |
||
| 122 | 122 | * @deprecated 0.0.2 This is not really used and should be removed in a future version. |
| 123 | 123 | * @return self |
| 124 | 124 | */ |
| 125 | - public function add_rest_route( Route $route ): self { |
|
| 126 | - $this->routes[ $route->get_method() ] = $route; |
|
| 125 | + public function add_rest_route(Route $route): self { |
|
| 126 | + $this->routes[$route->get_method()] = $route; |
|
| 127 | 127 | return $this; |
| 128 | 128 | } |
| 129 | 129 | |
@@ -142,8 +142,8 @@ discard block |
||
| 142 | 142 | * @param string $method |
| 143 | 143 | * @return bool |
| 144 | 144 | */ |
| 145 | - public function method_exists( string $method ): bool { |
|
| 146 | - return array_key_exists( \strtoupper( $method ), $this->routes ); |
|
| 145 | + public function method_exists(string $method): bool { |
|
| 146 | + return array_key_exists(\strtoupper($method), $this->routes); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
@@ -152,6 +152,6 @@ discard block |
||
| 152 | 152 | * @return bool |
| 153 | 153 | */ |
| 154 | 154 | public function has_routes(): bool { |
| 155 | - return ! empty( $this->routes ); |
|
| 155 | + return ! empty($this->routes); |
|
| 156 | 156 | } |
| 157 | 157 | } |