@@ -181,7 +181,7 @@ |
||
| 181 | 181 | */ |
| 182 | 182 | protected function dispatchToRouter() |
| 183 | 183 | { |
| 184 | - return function ($request) { |
|
| 184 | + return function($request) { |
|
| 185 | 185 | $this->app->instance('request', $request); |
| 186 | 186 | |
| 187 | 187 | return $this->router->dispatch($request); |
@@ -38,279 +38,279 @@ |
||
| 38 | 38 | */ |
| 39 | 39 | class Lenevor implements LenevorContract |
| 40 | 40 | { |
| 41 | - /** |
|
| 42 | - * The application implementation. |
|
| 43 | - * |
|
| 44 | - * @var \Syscodes\Components\Contracts\Core\Application $app |
|
| 45 | - */ |
|
| 46 | - protected $app; |
|
| 41 | + /** |
|
| 42 | + * The application implementation. |
|
| 43 | + * |
|
| 44 | + * @var \Syscodes\Components\Contracts\Core\Application $app |
|
| 45 | + */ |
|
| 46 | + protected $app; |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * The bootstrap classes for the application. |
|
| 50 | - * |
|
| 51 | - * @var array $bootstrappers |
|
| 52 | - */ |
|
| 53 | - protected $bootstrappers = [ |
|
| 54 | - \Syscodes\Components\Core\Bootstrap\BootDetectEnvironment::class, |
|
| 55 | - \Syscodes\Components\Core\Bootstrap\BootConfiguration::class, |
|
| 56 | - \Syscodes\Components\Core\Bootstrap\BootHandleExceptions::class, |
|
| 57 | - \Syscodes\Components\Core\Bootstrap\BootRegisterFacades::class, |
|
| 58 | - \Syscodes\Components\Core\Bootstrap\BootRegisterProviders::class, |
|
| 59 | - \Syscodes\Components\Core\Bootstrap\BootProviders::class, |
|
| 60 | - ]; |
|
| 48 | + /** |
|
| 49 | + * The bootstrap classes for the application. |
|
| 50 | + * |
|
| 51 | + * @var array $bootstrappers |
|
| 52 | + */ |
|
| 53 | + protected $bootstrappers = [ |
|
| 54 | + \Syscodes\Components\Core\Bootstrap\BootDetectEnvironment::class, |
|
| 55 | + \Syscodes\Components\Core\Bootstrap\BootConfiguration::class, |
|
| 56 | + \Syscodes\Components\Core\Bootstrap\BootHandleExceptions::class, |
|
| 57 | + \Syscodes\Components\Core\Bootstrap\BootRegisterFacades::class, |
|
| 58 | + \Syscodes\Components\Core\Bootstrap\BootRegisterProviders::class, |
|
| 59 | + \Syscodes\Components\Core\Bootstrap\BootProviders::class, |
|
| 60 | + ]; |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * Get the application's middleware. |
|
| 64 | - * |
|
| 65 | - * @var array $middleware |
|
| 66 | - */ |
|
| 67 | - protected $middleware = []; |
|
| 62 | + /** |
|
| 63 | + * Get the application's middleware. |
|
| 64 | + * |
|
| 65 | + * @var array $middleware |
|
| 66 | + */ |
|
| 67 | + protected $middleware = []; |
|
| 68 | 68 | |
| 69 | - /** |
|
| 70 | - * Get the application's middleware groups. |
|
| 71 | - * |
|
| 72 | - * @var array $middlewareGroups |
|
| 73 | - */ |
|
| 74 | - protected $middlewareGroups = []; |
|
| 69 | + /** |
|
| 70 | + * Get the application's middleware groups. |
|
| 71 | + * |
|
| 72 | + * @var array $middlewareGroups |
|
| 73 | + */ |
|
| 74 | + protected $middlewareGroups = []; |
|
| 75 | 75 | |
| 76 | - /** |
|
| 77 | - * The priority list of middleware. |
|
| 78 | - * |
|
| 79 | - * @var string[] $middlwarePriority |
|
| 80 | - */ |
|
| 81 | - protected $middlwarePriority = []; |
|
| 76 | + /** |
|
| 77 | + * The priority list of middleware. |
|
| 78 | + * |
|
| 79 | + * @var string[] $middlwarePriority |
|
| 80 | + */ |
|
| 81 | + protected $middlwarePriority = []; |
|
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * The router instance. |
|
| 85 | - * |
|
| 86 | - * @var \Syscodes\Components\Routing\Router $router |
|
| 87 | - */ |
|
| 88 | - protected $router; |
|
| 83 | + /** |
|
| 84 | + * The router instance. |
|
| 85 | + * |
|
| 86 | + * @var \Syscodes\Components\Routing\Router $router |
|
| 87 | + */ |
|
| 88 | + protected $router; |
|
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * Get the application's route middleware. |
|
| 92 | - * |
|
| 93 | - * @var array $routeMiddleware |
|
| 94 | - */ |
|
| 95 | - protected $routeMiddleware = []; |
|
| 90 | + /** |
|
| 91 | + * Get the application's route middleware. |
|
| 92 | + * |
|
| 93 | + * @var array $routeMiddleware |
|
| 94 | + */ |
|
| 95 | + protected $routeMiddleware = []; |
|
| 96 | 96 | |
| 97 | - /** |
|
| 98 | - * Total app execution time. |
|
| 99 | - * |
|
| 100 | - * @var float $totalTime |
|
| 101 | - */ |
|
| 102 | - protected $totalTime; |
|
| 97 | + /** |
|
| 98 | + * Total app execution time. |
|
| 99 | + * |
|
| 100 | + * @var float $totalTime |
|
| 101 | + */ |
|
| 102 | + protected $totalTime; |
|
| 103 | 103 | |
| 104 | - /** |
|
| 105 | - * Constructor. Lenevor class instance. |
|
| 106 | - * |
|
| 107 | - * @param \Syscodes\Components\Contracts\Core\Application $app |
|
| 108 | - * @param \Syscodes\Components\Routing\Router $router |
|
| 109 | - * |
|
| 110 | - * @return void |
|
| 111 | - */ |
|
| 112 | - public function __construct(Application $app, Router $router) |
|
| 113 | - { |
|
| 114 | - $this->app = $app; |
|
| 115 | - $this->router = $router; |
|
| 104 | + /** |
|
| 105 | + * Constructor. Lenevor class instance. |
|
| 106 | + * |
|
| 107 | + * @param \Syscodes\Components\Contracts\Core\Application $app |
|
| 108 | + * @param \Syscodes\Components\Routing\Router $router |
|
| 109 | + * |
|
| 110 | + * @return void |
|
| 111 | + */ |
|
| 112 | + public function __construct(Application $app, Router $router) |
|
| 113 | + { |
|
| 114 | + $this->app = $app; |
|
| 115 | + $this->router = $router; |
|
| 116 | 116 | |
| 117 | - $this->syncMiddlewareRoute(); |
|
| 118 | - } |
|
| 117 | + $this->syncMiddlewareRoute(); |
|
| 118 | + } |
|
| 119 | 119 | |
| 120 | - /** |
|
| 121 | - * {@inheritdoc} |
|
| 122 | - */ |
|
| 123 | - public function handle($request) |
|
| 124 | - { |
|
| 125 | - try { |
|
| 126 | - $response = $this->sendRequestThroughRouter($request); |
|
| 127 | - } catch (Throwable $e) { |
|
| 128 | - $this->reportException($e); |
|
| 120 | + /** |
|
| 121 | + * {@inheritdoc} |
|
| 122 | + */ |
|
| 123 | + public function handle($request) |
|
| 124 | + { |
|
| 125 | + try { |
|
| 126 | + $response = $this->sendRequestThroughRouter($request); |
|
| 127 | + } catch (Throwable $e) { |
|
| 128 | + $this->reportException($e); |
|
| 129 | 129 | |
| 130 | - $response = $this->renderException($request, $e); |
|
| 131 | - } |
|
| 130 | + $response = $this->renderException($request, $e); |
|
| 131 | + } |
|
| 132 | 132 | |
| 133 | - return $response; |
|
| 134 | - } |
|
| 133 | + return $response; |
|
| 134 | + } |
|
| 135 | 135 | |
| 136 | - /** |
|
| 137 | - * Send the given request through the router. |
|
| 138 | - * |
|
| 139 | - * @param \Syscodes\Components\Http\Request $request |
|
| 140 | - * |
|
| 141 | - * @return \Syscodes\Components\Http\Response |
|
| 142 | - */ |
|
| 143 | - protected function sendRequestThroughRouter($request) |
|
| 144 | - { |
|
| 145 | - $this->app->instance('request', $request); |
|
| 136 | + /** |
|
| 137 | + * Send the given request through the router. |
|
| 138 | + * |
|
| 139 | + * @param \Syscodes\Components\Http\Request $request |
|
| 140 | + * |
|
| 141 | + * @return \Syscodes\Components\Http\Response |
|
| 142 | + */ |
|
| 143 | + protected function sendRequestThroughRouter($request) |
|
| 144 | + { |
|
| 145 | + $this->app->instance('request', $request); |
|
| 146 | 146 | |
| 147 | - Facade::clearResolvedInstance('request'); |
|
| 147 | + Facade::clearResolvedInstance('request'); |
|
| 148 | 148 | |
| 149 | - // Load configuration system |
|
| 150 | - $this->bootstrap(); |
|
| 149 | + // Load configuration system |
|
| 150 | + $this->bootstrap(); |
|
| 151 | 151 | |
| 152 | - return (new Pipeline($this->app)) |
|
| 153 | - ->send($request) |
|
| 154 | - ->through($this->app->skipGoingMiddleware() ? [] : $this->middleware) |
|
| 155 | - ->then($this->dispatchToRouter()); |
|
| 156 | - } |
|
| 152 | + return (new Pipeline($this->app)) |
|
| 153 | + ->send($request) |
|
| 154 | + ->through($this->app->skipGoingMiddleware() ? [] : $this->middleware) |
|
| 155 | + ->then($this->dispatchToRouter()); |
|
| 156 | + } |
|
| 157 | 157 | |
| 158 | - /** |
|
| 159 | - * Bootstrap the application for HTTP requests. |
|
| 160 | - * |
|
| 161 | - * @return void |
|
| 162 | - */ |
|
| 163 | - protected function bootstrap(): void |
|
| 164 | - { |
|
| 165 | - if ( ! $this->app->hasBeenBootstrapped()) { |
|
| 166 | - $this->app->bootstrapWith($this->bootstrappers()); |
|
| 167 | - } |
|
| 168 | - } |
|
| 158 | + /** |
|
| 159 | + * Bootstrap the application for HTTP requests. |
|
| 160 | + * |
|
| 161 | + * @return void |
|
| 162 | + */ |
|
| 163 | + protected function bootstrap(): void |
|
| 164 | + { |
|
| 165 | + if ( ! $this->app->hasBeenBootstrapped()) { |
|
| 166 | + $this->app->bootstrapWith($this->bootstrappers()); |
|
| 167 | + } |
|
| 168 | + } |
|
| 169 | 169 | |
| 170 | - /** |
|
| 171 | - * Get the bootstrap classes for the application. |
|
| 172 | - * |
|
| 173 | - * @return array |
|
| 174 | - */ |
|
| 175 | - protected function bootstrappers(): array |
|
| 176 | - { |
|
| 177 | - return $this->bootstrappers; |
|
| 178 | - } |
|
| 170 | + /** |
|
| 171 | + * Get the bootstrap classes for the application. |
|
| 172 | + * |
|
| 173 | + * @return array |
|
| 174 | + */ |
|
| 175 | + protected function bootstrappers(): array |
|
| 176 | + { |
|
| 177 | + return $this->bootstrappers; |
|
| 178 | + } |
|
| 179 | 179 | |
| 180 | - /** |
|
| 181 | - * Sync the current state of the middleware to the router. |
|
| 182 | - * |
|
| 183 | - * @return void |
|
| 184 | - */ |
|
| 185 | - protected function syncMiddlewareRoute(): void |
|
| 186 | - { |
|
| 187 | - $this->router->middlewarePriority = $this->middlwarePriority; |
|
| 180 | + /** |
|
| 181 | + * Sync the current state of the middleware to the router. |
|
| 182 | + * |
|
| 183 | + * @return void |
|
| 184 | + */ |
|
| 185 | + protected function syncMiddlewareRoute(): void |
|
| 186 | + { |
|
| 187 | + $this->router->middlewarePriority = $this->middlwarePriority; |
|
| 188 | 188 | |
| 189 | - foreach ($this->middlewareGroups as $key => $middleware) { |
|
| 190 | - $this->router->middlewareGroup($key, $middleware); |
|
| 191 | - } |
|
| 189 | + foreach ($this->middlewareGroups as $key => $middleware) { |
|
| 190 | + $this->router->middlewareGroup($key, $middleware); |
|
| 191 | + } |
|
| 192 | 192 | |
| 193 | - foreach ($this->routeMiddleware as $key => $middleware) { |
|
| 194 | - $this->router->aliasMiddleware($key, $middleware); |
|
| 195 | - } |
|
| 196 | - } |
|
| 193 | + foreach ($this->routeMiddleware as $key => $middleware) { |
|
| 194 | + $this->router->aliasMiddleware($key, $middleware); |
|
| 195 | + } |
|
| 196 | + } |
|
| 197 | 197 | |
| 198 | - /** |
|
| 199 | - * Get the dispatcher of routes. |
|
| 200 | - * |
|
| 201 | - * @return \Closure |
|
| 202 | - */ |
|
| 203 | - protected function dispatchToRouter() |
|
| 204 | - { |
|
| 205 | - return function ($request) { |
|
| 206 | - $this->app->instance('request', $request); |
|
| 198 | + /** |
|
| 199 | + * Get the dispatcher of routes. |
|
| 200 | + * |
|
| 201 | + * @return \Closure |
|
| 202 | + */ |
|
| 203 | + protected function dispatchToRouter() |
|
| 204 | + { |
|
| 205 | + return function ($request) { |
|
| 206 | + $this->app->instance('request', $request); |
|
| 207 | 207 | |
| 208 | - return $this->router->dispatch($request); |
|
| 209 | - }; |
|
| 210 | - } |
|
| 208 | + return $this->router->dispatch($request); |
|
| 209 | + }; |
|
| 210 | + } |
|
| 211 | 211 | |
| 212 | - /** |
|
| 213 | - * {@inheritdoc} |
|
| 214 | - */ |
|
| 215 | - public function shutdown($request, $response): void |
|
| 216 | - { |
|
| 217 | - $this->shutdownMiddleware($request, $response); |
|
| 218 | - } |
|
| 212 | + /** |
|
| 213 | + * {@inheritdoc} |
|
| 214 | + */ |
|
| 215 | + public function shutdown($request, $response): void |
|
| 216 | + { |
|
| 217 | + $this->shutdownMiddleware($request, $response); |
|
| 218 | + } |
|
| 219 | 219 | |
| 220 | - /** |
|
| 221 | - * Call the terminate method on any terminable middleware. |
|
| 222 | - * |
|
| 223 | - * @param \Syscodes\Components\Http\Request $request |
|
| 224 | - * @param \Syscodes\Components\Http\Response $response |
|
| 225 | - * |
|
| 226 | - * @return void |
|
| 227 | - */ |
|
| 228 | - protected function shutdownMiddleware($request, $response): void |
|
| 229 | - { |
|
| 230 | - $middlewares = $this->app->skipGoingMiddleware() ? [] : array_merge( |
|
| 231 | - $this->gatherRouteMiddleware($request), |
|
| 232 | - $this->middleware |
|
| 233 | - ); |
|
| 220 | + /** |
|
| 221 | + * Call the terminate method on any terminable middleware. |
|
| 222 | + * |
|
| 223 | + * @param \Syscodes\Components\Http\Request $request |
|
| 224 | + * @param \Syscodes\Components\Http\Response $response |
|
| 225 | + * |
|
| 226 | + * @return void |
|
| 227 | + */ |
|
| 228 | + protected function shutdownMiddleware($request, $response): void |
|
| 229 | + { |
|
| 230 | + $middlewares = $this->app->skipGoingMiddleware() ? [] : array_merge( |
|
| 231 | + $this->gatherRouteMiddleware($request), |
|
| 232 | + $this->middleware |
|
| 233 | + ); |
|
| 234 | 234 | |
| 235 | - foreach ($middlewares as $middleware) { |
|
| 236 | - if ( ! is_string($middleware)) { |
|
| 237 | - continue; |
|
| 238 | - } |
|
| 235 | + foreach ($middlewares as $middleware) { |
|
| 236 | + if ( ! is_string($middleware)) { |
|
| 237 | + continue; |
|
| 238 | + } |
|
| 239 | 239 | |
| 240 | - [$name] = $this->parseMiddleware($middleware); |
|
| 240 | + [$name] = $this->parseMiddleware($middleware); |
|
| 241 | 241 | |
| 242 | - $instance = $this->app->make($name); |
|
| 242 | + $instance = $this->app->make($name); |
|
| 243 | 243 | |
| 244 | - if (method_exists($instance, 'shutdown')) { |
|
| 245 | - $instance->shutdown($request, $response); |
|
| 246 | - } |
|
| 247 | - } |
|
| 248 | - } |
|
| 244 | + if (method_exists($instance, 'shutdown')) { |
|
| 245 | + $instance->shutdown($request, $response); |
|
| 246 | + } |
|
| 247 | + } |
|
| 248 | + } |
|
| 249 | 249 | |
| 250 | - /** |
|
| 251 | - * Gather the route middleware for the given request. |
|
| 252 | - * |
|
| 253 | - * @param \Syscodes\Components\Http\Request $request |
|
| 254 | - * |
|
| 255 | - * @return array |
|
| 256 | - */ |
|
| 257 | - protected function gatherRouteMiddleware($request): array |
|
| 258 | - { |
|
| 259 | - if ($route = $request->route()) { |
|
| 260 | - return $this->router->gatherRouteMiddleware($route); |
|
| 261 | - } |
|
| 250 | + /** |
|
| 251 | + * Gather the route middleware for the given request. |
|
| 252 | + * |
|
| 253 | + * @param \Syscodes\Components\Http\Request $request |
|
| 254 | + * |
|
| 255 | + * @return array |
|
| 256 | + */ |
|
| 257 | + protected function gatherRouteMiddleware($request): array |
|
| 258 | + { |
|
| 259 | + if ($route = $request->route()) { |
|
| 260 | + return $this->router->gatherRouteMiddleware($route); |
|
| 261 | + } |
|
| 262 | 262 | |
| 263 | - return []; |
|
| 264 | - } |
|
| 263 | + return []; |
|
| 264 | + } |
|
| 265 | 265 | |
| 266 | - /** |
|
| 267 | - * Parse a middleware string to get the name and parameters. |
|
| 268 | - * |
|
| 269 | - * @param string $middleware |
|
| 270 | - * |
|
| 271 | - * @return array |
|
| 272 | - */ |
|
| 273 | - protected function parseMiddleware($middleware): array |
|
| 274 | - { |
|
| 275 | - [$name, $parameters] = array_pad(explode(':', $middleware, 2), 2, []); |
|
| 266 | + /** |
|
| 267 | + * Parse a middleware string to get the name and parameters. |
|
| 268 | + * |
|
| 269 | + * @param string $middleware |
|
| 270 | + * |
|
| 271 | + * @return array |
|
| 272 | + */ |
|
| 273 | + protected function parseMiddleware($middleware): array |
|
| 274 | + { |
|
| 275 | + [$name, $parameters] = array_pad(explode(':', $middleware, 2), 2, []); |
|
| 276 | 276 | |
| 277 | - if (is_string($parameters)) { |
|
| 278 | - $parameters = explode(',', $parameters); |
|
| 279 | - } |
|
| 277 | + if (is_string($parameters)) { |
|
| 278 | + $parameters = explode(',', $parameters); |
|
| 279 | + } |
|
| 280 | 280 | |
| 281 | - return [$name, $parameters]; |
|
| 281 | + return [$name, $parameters]; |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | - /** |
|
| 285 | - * {@inheritdoc} |
|
| 286 | - */ |
|
| 287 | - public function getApplication() |
|
| 288 | - { |
|
| 289 | - return $this->app; |
|
| 290 | - } |
|
| 284 | + /** |
|
| 285 | + * {@inheritdoc} |
|
| 286 | + */ |
|
| 287 | + public function getApplication() |
|
| 288 | + { |
|
| 289 | + return $this->app; |
|
| 290 | + } |
|
| 291 | 291 | |
| 292 | - /** |
|
| 293 | - * Report the exception to the exception handler. |
|
| 294 | - * |
|
| 295 | - * @param \Throwable $e |
|
| 296 | - * |
|
| 297 | - * @return void |
|
| 298 | - */ |
|
| 299 | - protected function reportException(Throwable $e) |
|
| 300 | - { |
|
| 301 | - return $this->app[ExceptionHandler::class]->report($e); |
|
| 302 | - } |
|
| 292 | + /** |
|
| 293 | + * Report the exception to the exception handler. |
|
| 294 | + * |
|
| 295 | + * @param \Throwable $e |
|
| 296 | + * |
|
| 297 | + * @return void |
|
| 298 | + */ |
|
| 299 | + protected function reportException(Throwable $e) |
|
| 300 | + { |
|
| 301 | + return $this->app[ExceptionHandler::class]->report($e); |
|
| 302 | + } |
|
| 303 | 303 | |
| 304 | - /** |
|
| 305 | - * Render the exception to a response. |
|
| 306 | - * |
|
| 307 | - * @param \Syscodes\Components\Http\Request $request |
|
| 308 | - * @param \Throwable $e |
|
| 309 | - * |
|
| 310 | - * @return \Syscodes\Components\Http\Response |
|
| 311 | - */ |
|
| 312 | - protected function renderException($request, Throwable $e) |
|
| 313 | - { |
|
| 314 | - return $this->app[ExceptionHandler::class]->render($request, $e); |
|
| 315 | - } |
|
| 304 | + /** |
|
| 305 | + * Render the exception to a response. |
|
| 306 | + * |
|
| 307 | + * @param \Syscodes\Components\Http\Request $request |
|
| 308 | + * @param \Throwable $e |
|
| 309 | + * |
|
| 310 | + * @return \Syscodes\Components\Http\Response |
|
| 311 | + */ |
|
| 312 | + protected function renderException($request, Throwable $e) |
|
| 313 | + { |
|
| 314 | + return $this->app[ExceptionHandler::class]->render($request, $e); |
|
| 315 | + } |
|
| 316 | 316 | } |
| 317 | 317 | \ No newline at end of file |
@@ -32,35 +32,35 @@ |
||
| 32 | 32 | */ |
| 33 | 33 | class NotFoundHttpException extends HttpException |
| 34 | 34 | { |
| 35 | - /** |
|
| 36 | - * Get the HTTP status code. |
|
| 37 | - * |
|
| 38 | - * @var int $code |
|
| 39 | - */ |
|
| 40 | - protected $code = 404; |
|
| 35 | + /** |
|
| 36 | + * Get the HTTP status code. |
|
| 37 | + * |
|
| 38 | + * @var int $code |
|
| 39 | + */ |
|
| 40 | + protected $code = 404; |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * Initialize constructor. |
|
| 44 | - * |
|
| 45 | - * @param string|null $message (null by default) |
|
| 46 | - * @param \Throwable|null $previous (null by default) |
|
| 47 | - * @param int $code (0 by default) |
|
| 48 | - * @param array $headers |
|
| 49 | - * |
|
| 50 | - * @return void |
|
| 51 | - */ |
|
| 52 | - public function __construct( |
|
| 53 | - ?string $message = null, |
|
| 54 | - ?Throwable $previous = null, |
|
| 55 | - int $code = 0, |
|
| 56 | - array $headers = [] |
|
| 57 | - ) { |
|
| 42 | + /** |
|
| 43 | + * Initialize constructor. |
|
| 44 | + * |
|
| 45 | + * @param string|null $message (null by default) |
|
| 46 | + * @param \Throwable|null $previous (null by default) |
|
| 47 | + * @param int $code (0 by default) |
|
| 48 | + * @param array $headers |
|
| 49 | + * |
|
| 50 | + * @return void |
|
| 51 | + */ |
|
| 52 | + public function __construct( |
|
| 53 | + ?string $message = null, |
|
| 54 | + ?Throwable $previous = null, |
|
| 55 | + int $code = 0, |
|
| 56 | + array $headers = [] |
|
| 57 | + ) { |
|
| 58 | 58 | parent::__construct( |
| 59 | - $this->code, |
|
| 60 | - $message, |
|
| 61 | - $previous, |
|
| 62 | - $headers, |
|
| 63 | - $code |
|
| 64 | - ); |
|
| 65 | - } |
|
| 59 | + $this->code, |
|
| 60 | + $message, |
|
| 61 | + $previous, |
|
| 62 | + $headers, |
|
| 63 | + $code |
|
| 64 | + ); |
|
| 65 | + } |
|
| 66 | 66 | } |
| 67 | 67 | \ No newline at end of file |
@@ -36,42 +36,42 @@ |
||
| 36 | 36 | */ |
| 37 | 37 | class ServiceUnavailableHttpException extends HttpException |
| 38 | 38 | { |
| 39 | - /** |
|
| 40 | - * Get the HTTP status code. |
|
| 41 | - * |
|
| 42 | - * @var int $code |
|
| 43 | - */ |
|
| 44 | - protected $code = 503; |
|
| 39 | + /** |
|
| 40 | + * Get the HTTP status code. |
|
| 41 | + * |
|
| 42 | + * @var int $code |
|
| 43 | + */ |
|
| 44 | + protected $code = 503; |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Initialize constructor. |
|
| 48 | - * |
|
| 49 | - * @param int|string|null $retryAfter The number of seconds or HTTP-date after |
|
| 50 | - * which the request may be retried (null by default) |
|
| 51 | - * @param string|null $message (null by default) |
|
| 52 | - * @param \Throwable|null $previous (null by default) |
|
| 53 | - * @param int $code (0 by default) |
|
| 54 | - * @param array $headers |
|
| 55 | - * |
|
| 56 | - * @return void |
|
| 57 | - */ |
|
| 58 | - public function __construct( |
|
| 59 | - $retryAfter = null, |
|
| 60 | - string $message = null, |
|
| 61 | - Throwable $previous = null, |
|
| 62 | - ?int $code = 0, |
|
| 63 | - array $headers = [] |
|
| 64 | - ) { |
|
| 65 | - if ($retryAfter) { |
|
| 66 | - $headers['Retry-After'] = $retryAfter; |
|
| 67 | - } |
|
| 46 | + /** |
|
| 47 | + * Initialize constructor. |
|
| 48 | + * |
|
| 49 | + * @param int|string|null $retryAfter The number of seconds or HTTP-date after |
|
| 50 | + * which the request may be retried (null by default) |
|
| 51 | + * @param string|null $message (null by default) |
|
| 52 | + * @param \Throwable|null $previous (null by default) |
|
| 53 | + * @param int $code (0 by default) |
|
| 54 | + * @param array $headers |
|
| 55 | + * |
|
| 56 | + * @return void |
|
| 57 | + */ |
|
| 58 | + public function __construct( |
|
| 59 | + $retryAfter = null, |
|
| 60 | + string $message = null, |
|
| 61 | + Throwable $previous = null, |
|
| 62 | + ?int $code = 0, |
|
| 63 | + array $headers = [] |
|
| 64 | + ) { |
|
| 65 | + if ($retryAfter) { |
|
| 66 | + $headers['Retry-After'] = $retryAfter; |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - parent::__construct( |
|
| 70 | - $this->code, |
|
| 71 | - $message, |
|
| 72 | - $previous, |
|
| 73 | - $headers, |
|
| 74 | - $code |
|
| 75 | - ); |
|
| 76 | - } |
|
| 69 | + parent::__construct( |
|
| 70 | + $this->code, |
|
| 71 | + $message, |
|
| 72 | + $previous, |
|
| 73 | + $headers, |
|
| 74 | + $code |
|
| 75 | + ); |
|
| 76 | + } |
|
| 77 | 77 | } |
| 78 | 78 | \ No newline at end of file |
@@ -32,35 +32,35 @@ |
||
| 32 | 32 | */ |
| 33 | 33 | class ServerErrorHttpException extends HttpException |
| 34 | 34 | { |
| 35 | - /** |
|
| 36 | - * Get the HTTP status code. |
|
| 37 | - * |
|
| 38 | - * @var int $code |
|
| 39 | - */ |
|
| 40 | - protected $code = 500; |
|
| 35 | + /** |
|
| 36 | + * Get the HTTP status code. |
|
| 37 | + * |
|
| 38 | + * @var int $code |
|
| 39 | + */ |
|
| 40 | + protected $code = 500; |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * Initialize constructor. |
|
| 44 | - * |
|
| 45 | - * @param string|null $message (null by default) |
|
| 46 | - * @param \Throwable|null $previous (null by default) |
|
| 47 | - * @param int $code (0 by default) |
|
| 48 | - * @param array $headers |
|
| 49 | - * |
|
| 50 | - * @return void |
|
| 51 | - */ |
|
| 52 | - public function __construct( |
|
| 53 | - string $message = null, |
|
| 54 | - Throwable $previous = null, |
|
| 55 | - int $code = 0, |
|
| 56 | - array $headers = [] |
|
| 57 | - ) { |
|
| 42 | + /** |
|
| 43 | + * Initialize constructor. |
|
| 44 | + * |
|
| 45 | + * @param string|null $message (null by default) |
|
| 46 | + * @param \Throwable|null $previous (null by default) |
|
| 47 | + * @param int $code (0 by default) |
|
| 48 | + * @param array $headers |
|
| 49 | + * |
|
| 50 | + * @return void |
|
| 51 | + */ |
|
| 52 | + public function __construct( |
|
| 53 | + string $message = null, |
|
| 54 | + Throwable $previous = null, |
|
| 55 | + int $code = 0, |
|
| 56 | + array $headers = [] |
|
| 57 | + ) { |
|
| 58 | 58 | parent::__construct( |
| 59 | - $this->code, |
|
| 60 | - $message, |
|
| 61 | - $previous, |
|
| 62 | - $headers, |
|
| 63 | - $code |
|
| 64 | - ); |
|
| 65 | - } |
|
| 59 | + $this->code, |
|
| 60 | + $message, |
|
| 61 | + $previous, |
|
| 62 | + $headers, |
|
| 63 | + $code |
|
| 64 | + ); |
|
| 65 | + } |
|
| 66 | 66 | } |
| 67 | 67 | \ No newline at end of file |
@@ -32,35 +32,35 @@ |
||
| 32 | 32 | */ |
| 33 | 33 | class BadRequestHttpException extends HttpException |
| 34 | 34 | { |
| 35 | - /** |
|
| 36 | - * Get the HTTP status code. |
|
| 37 | - * |
|
| 38 | - * @var int $code |
|
| 39 | - */ |
|
| 40 | - protected $code = 400; |
|
| 35 | + /** |
|
| 36 | + * Get the HTTP status code. |
|
| 37 | + * |
|
| 38 | + * @var int $code |
|
| 39 | + */ |
|
| 40 | + protected $code = 400; |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * Initialize constructor. |
|
| 44 | - * |
|
| 45 | - * @param string|null $message (null by default) |
|
| 46 | - * @param \Throwable|null $previous (null by default) |
|
| 47 | - * @param int $code (0 by default) |
|
| 48 | - * @param array $headers |
|
| 49 | - * |
|
| 50 | - * @return void |
|
| 51 | - */ |
|
| 52 | - public function __construct( |
|
| 53 | - string $message = null, |
|
| 54 | - Throwable $previous = null, |
|
| 55 | - int $code = 0, |
|
| 56 | - array $headers = [] |
|
| 57 | - ) { |
|
| 42 | + /** |
|
| 43 | + * Initialize constructor. |
|
| 44 | + * |
|
| 45 | + * @param string|null $message (null by default) |
|
| 46 | + * @param \Throwable|null $previous (null by default) |
|
| 47 | + * @param int $code (0 by default) |
|
| 48 | + * @param array $headers |
|
| 49 | + * |
|
| 50 | + * @return void |
|
| 51 | + */ |
|
| 52 | + public function __construct( |
|
| 53 | + string $message = null, |
|
| 54 | + Throwable $previous = null, |
|
| 55 | + int $code = 0, |
|
| 56 | + array $headers = [] |
|
| 57 | + ) { |
|
| 58 | 58 | parent::__construct( |
| 59 | - $this->code, |
|
| 60 | - $message, |
|
| 61 | - $previous, |
|
| 62 | - $headers, |
|
| 63 | - $code |
|
| 64 | - ); |
|
| 65 | - } |
|
| 59 | + $this->code, |
|
| 60 | + $message, |
|
| 61 | + $previous, |
|
| 62 | + $headers, |
|
| 63 | + $code |
|
| 64 | + ); |
|
| 65 | + } |
|
| 66 | 66 | } |
| 67 | 67 | \ No newline at end of file |
@@ -33,35 +33,35 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | class PreconditionFailedHttpException extends HttpException |
| 35 | 35 | { |
| 36 | - /** |
|
| 37 | - * Get the HTTP status code. |
|
| 38 | - * |
|
| 39 | - * @var int $code |
|
| 40 | - */ |
|
| 41 | - protected $code = 412; |
|
| 36 | + /** |
|
| 37 | + * Get the HTTP status code. |
|
| 38 | + * |
|
| 39 | + * @var int $code |
|
| 40 | + */ |
|
| 41 | + protected $code = 412; |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * Initialize constructor. |
|
| 45 | - * |
|
| 46 | - * @param string|null $message (null by default) |
|
| 47 | - * @param \Throwable|null $previous (null by default) |
|
| 48 | - * @param int $code (0 by default) |
|
| 49 | - * @param array $headers |
|
| 50 | - * |
|
| 51 | - * @return void |
|
| 52 | - */ |
|
| 53 | - public function __construct( |
|
| 54 | - string $message = null, |
|
| 55 | - Throwable $previous = null, |
|
| 56 | - int $code = 0, |
|
| 57 | - array $headers = [] |
|
| 58 | - ) { |
|
| 59 | - parent::__construct( |
|
| 60 | - $this->code, |
|
| 61 | - $message, |
|
| 62 | - $previous, |
|
| 63 | - $headers, |
|
| 64 | - $code |
|
| 65 | - ); |
|
| 66 | - } |
|
| 43 | + /** |
|
| 44 | + * Initialize constructor. |
|
| 45 | + * |
|
| 46 | + * @param string|null $message (null by default) |
|
| 47 | + * @param \Throwable|null $previous (null by default) |
|
| 48 | + * @param int $code (0 by default) |
|
| 49 | + * @param array $headers |
|
| 50 | + * |
|
| 51 | + * @return void |
|
| 52 | + */ |
|
| 53 | + public function __construct( |
|
| 54 | + string $message = null, |
|
| 55 | + Throwable $previous = null, |
|
| 56 | + int $code = 0, |
|
| 57 | + array $headers = [] |
|
| 58 | + ) { |
|
| 59 | + parent::__construct( |
|
| 60 | + $this->code, |
|
| 61 | + $message, |
|
| 62 | + $previous, |
|
| 63 | + $headers, |
|
| 64 | + $code |
|
| 65 | + ); |
|
| 66 | + } |
|
| 67 | 67 | } |
| 68 | 68 | \ No newline at end of file |
@@ -33,35 +33,35 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | class UnprocessableEntityHttpException extends HttpException |
| 35 | 35 | { |
| 36 | - /** |
|
| 37 | - * Get the HTTP status code. |
|
| 38 | - * |
|
| 39 | - * @var int $code |
|
| 40 | - */ |
|
| 41 | - protected $code = 422; |
|
| 36 | + /** |
|
| 37 | + * Get the HTTP status code. |
|
| 38 | + * |
|
| 39 | + * @var int $code |
|
| 40 | + */ |
|
| 41 | + protected $code = 422; |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * Initialize constructor. |
|
| 45 | - * |
|
| 46 | - * @param string|null $message (null by default) |
|
| 47 | - * @param \Throwable|null $previous (null by default) |
|
| 48 | - * @param int $code (0 by default) |
|
| 49 | - * @param array $headers |
|
| 50 | - * |
|
| 51 | - * @return void |
|
| 52 | - */ |
|
| 53 | - public function __construct( |
|
| 54 | - string $message = null, |
|
| 55 | - Throwable $previous = null, |
|
| 56 | - int $code = 0, |
|
| 57 | - array $headers = [] |
|
| 58 | - ) { |
|
| 59 | - parent::__construct( |
|
| 60 | - $this->code, |
|
| 61 | - $message, |
|
| 62 | - $previous, |
|
| 63 | - $headers, |
|
| 64 | - $code |
|
| 65 | - ); |
|
| 66 | - } |
|
| 43 | + /** |
|
| 44 | + * Initialize constructor. |
|
| 45 | + * |
|
| 46 | + * @param string|null $message (null by default) |
|
| 47 | + * @param \Throwable|null $previous (null by default) |
|
| 48 | + * @param int $code (0 by default) |
|
| 49 | + * @param array $headers |
|
| 50 | + * |
|
| 51 | + * @return void |
|
| 52 | + */ |
|
| 53 | + public function __construct( |
|
| 54 | + string $message = null, |
|
| 55 | + Throwable $previous = null, |
|
| 56 | + int $code = 0, |
|
| 57 | + array $headers = [] |
|
| 58 | + ) { |
|
| 59 | + parent::__construct( |
|
| 60 | + $this->code, |
|
| 61 | + $message, |
|
| 62 | + $previous, |
|
| 63 | + $headers, |
|
| 64 | + $code |
|
| 65 | + ); |
|
| 66 | + } |
|
| 67 | 67 | } |
| 68 | 68 | \ No newline at end of file |
@@ -33,39 +33,39 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | class MethodNotAllowedHttpException extends HttpException |
| 35 | 35 | { |
| 36 | - /** |
|
| 37 | - * Get the HTTP status code. |
|
| 38 | - * |
|
| 39 | - * @var int $code |
|
| 40 | - */ |
|
| 41 | - protected $code = 405; |
|
| 36 | + /** |
|
| 37 | + * Get the HTTP status code. |
|
| 38 | + * |
|
| 39 | + * @var int $code |
|
| 40 | + */ |
|
| 41 | + protected $code = 405; |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * Initialize constructor. |
|
| 45 | - * |
|
| 46 | - * @param array $allow |
|
| 47 | - * @param string|null $message (null by default) |
|
| 48 | - * @param \Throwable|null $previous (null by default) |
|
| 49 | - * @param int $code (0 by default) |
|
| 50 | - * @param array $headers |
|
| 51 | - * |
|
| 52 | - * @return void |
|
| 53 | - */ |
|
| 54 | - public function __construct( |
|
| 55 | - array $allow = [], |
|
| 56 | - string $message = null, |
|
| 57 | - Throwable $previous = null, |
|
| 58 | - ?int $code = 0, |
|
| 59 | - array $headers = [] |
|
| 60 | - ) { |
|
| 61 | - $headers['Allow'] = strtoupper(implode(', ', $allow)); |
|
| 43 | + /** |
|
| 44 | + * Initialize constructor. |
|
| 45 | + * |
|
| 46 | + * @param array $allow |
|
| 47 | + * @param string|null $message (null by default) |
|
| 48 | + * @param \Throwable|null $previous (null by default) |
|
| 49 | + * @param int $code (0 by default) |
|
| 50 | + * @param array $headers |
|
| 51 | + * |
|
| 52 | + * @return void |
|
| 53 | + */ |
|
| 54 | + public function __construct( |
|
| 55 | + array $allow = [], |
|
| 56 | + string $message = null, |
|
| 57 | + Throwable $previous = null, |
|
| 58 | + ?int $code = 0, |
|
| 59 | + array $headers = [] |
|
| 60 | + ) { |
|
| 61 | + $headers['Allow'] = strtoupper(implode(', ', $allow)); |
|
| 62 | 62 | |
| 63 | - parent::__construct( |
|
| 64 | - $this->code, |
|
| 65 | - $message, |
|
| 66 | - $previous, |
|
| 67 | - $headers, |
|
| 68 | - $code |
|
| 69 | - ); |
|
| 70 | - } |
|
| 63 | + parent::__construct( |
|
| 64 | + $this->code, |
|
| 65 | + $message, |
|
| 66 | + $previous, |
|
| 67 | + $headers, |
|
| 68 | + $code |
|
| 69 | + ); |
|
| 70 | + } |
|
| 71 | 71 | } |
| 72 | 72 | \ No newline at end of file |
@@ -33,35 +33,35 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | class UnsupportedMediaTypeHttpException extends HttpException |
| 35 | 35 | { |
| 36 | - /** |
|
| 37 | - * Get the HTTP status code. |
|
| 38 | - * |
|
| 39 | - * @var int $code |
|
| 40 | - */ |
|
| 41 | - protected $code = 415; |
|
| 36 | + /** |
|
| 37 | + * Get the HTTP status code. |
|
| 38 | + * |
|
| 39 | + * @var int $code |
|
| 40 | + */ |
|
| 41 | + protected $code = 415; |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * Initialize constructor. |
|
| 45 | - * |
|
| 46 | - * @param string|null $message (null by default) |
|
| 47 | - * @param \Throwable|null $previous (null by default) |
|
| 48 | - * @param int $code (0 by default) |
|
| 49 | - * @param array $headers |
|
| 50 | - * |
|
| 51 | - * @return void |
|
| 52 | - */ |
|
| 53 | - public function __construct( |
|
| 54 | - string $message = null, |
|
| 55 | - Throwable $previous = null, |
|
| 56 | - int $code = 0, |
|
| 57 | - array $headers = [] |
|
| 58 | - ) { |
|
| 59 | - parent::__construct( |
|
| 60 | - $this->code, |
|
| 61 | - $message, |
|
| 62 | - $previous, |
|
| 63 | - $headers, |
|
| 64 | - $code |
|
| 65 | - ); |
|
| 66 | - } |
|
| 43 | + /** |
|
| 44 | + * Initialize constructor. |
|
| 45 | + * |
|
| 46 | + * @param string|null $message (null by default) |
|
| 47 | + * @param \Throwable|null $previous (null by default) |
|
| 48 | + * @param int $code (0 by default) |
|
| 49 | + * @param array $headers |
|
| 50 | + * |
|
| 51 | + * @return void |
|
| 52 | + */ |
|
| 53 | + public function __construct( |
|
| 54 | + string $message = null, |
|
| 55 | + Throwable $previous = null, |
|
| 56 | + int $code = 0, |
|
| 57 | + array $headers = [] |
|
| 58 | + ) { |
|
| 59 | + parent::__construct( |
|
| 60 | + $this->code, |
|
| 61 | + $message, |
|
| 62 | + $previous, |
|
| 63 | + $headers, |
|
| 64 | + $code |
|
| 65 | + ); |
|
| 66 | + } |
|
| 67 | 67 | } |
| 68 | 68 | \ No newline at end of file |