@@ -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,163 +38,163 @@ |
||
| 38 | 38 | */ |
| 39 | 39 | class Lenevor implements LenevorContract |
| 40 | 40 | { |
| 41 | - /** |
|
| 42 | - * The application implementation. |
|
| 43 | - * |
|
| 44 | - * @var \Syscodes\Contracts\Core\Application $app |
|
| 45 | - */ |
|
| 46 | - protected $app; |
|
| 41 | + /** |
|
| 42 | + * The application implementation. |
|
| 43 | + * |
|
| 44 | + * @var \Syscodes\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\Core\Bootstrap\BootDetectEnvironment::class, |
|
| 55 | - \Syscodes\Core\Bootstrap\BootConfiguration::class, |
|
| 56 | - \Syscodes\Core\Bootstrap\BootHandleExceptions::class, |
|
| 57 | - \Syscodes\Core\Bootstrap\BootRegisterFacades::class, |
|
| 58 | - \Syscodes\Core\Bootstrap\BootRegisterProviders::class, |
|
| 59 | - \Syscodes\Core\Bootstrap\BootProviders::class, |
|
| 60 | - ]; |
|
| 61 | - |
|
| 62 | - /** |
|
| 63 | - * Get the application's middleware. |
|
| 64 | - * |
|
| 65 | - * @var array $middleware |
|
| 66 | - */ |
|
| 67 | - protected $middleware = []; |
|
| 68 | - |
|
| 69 | - /** |
|
| 70 | - * The router instance. |
|
| 71 | - * |
|
| 72 | - * @var \Syscodes\Routing\Router $router |
|
| 73 | - */ |
|
| 74 | - protected $router; |
|
| 75 | - |
|
| 76 | - /** |
|
| 77 | - * Total app execution time. |
|
| 78 | - * |
|
| 79 | - * @var float $totalTime |
|
| 80 | - */ |
|
| 81 | - protected $totalTime; |
|
| 82 | - |
|
| 83 | - /** |
|
| 84 | - * Constructor. Lenevor class instance. |
|
| 85 | - * |
|
| 86 | - * @param \Syscodes\Contracts\Core\Application $app |
|
| 87 | - * @param \Syscodes\Routing\Router $router |
|
| 88 | - * |
|
| 89 | - * @return void |
|
| 90 | - */ |
|
| 91 | - public function __construct(Application $app, Router $router) |
|
| 92 | - { |
|
| 93 | - $this->app = $app; |
|
| 94 | - $this->router = $router; |
|
| 95 | - } |
|
| 48 | + /** |
|
| 49 | + * The bootstrap classes for the application. |
|
| 50 | + * |
|
| 51 | + * @var array $bootstrappers |
|
| 52 | + */ |
|
| 53 | + protected $bootstrappers = [ |
|
| 54 | + \Syscodes\Core\Bootstrap\BootDetectEnvironment::class, |
|
| 55 | + \Syscodes\Core\Bootstrap\BootConfiguration::class, |
|
| 56 | + \Syscodes\Core\Bootstrap\BootHandleExceptions::class, |
|
| 57 | + \Syscodes\Core\Bootstrap\BootRegisterFacades::class, |
|
| 58 | + \Syscodes\Core\Bootstrap\BootRegisterProviders::class, |
|
| 59 | + \Syscodes\Core\Bootstrap\BootProviders::class, |
|
| 60 | + ]; |
|
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * Get the application's middleware. |
|
| 64 | + * |
|
| 65 | + * @var array $middleware |
|
| 66 | + */ |
|
| 67 | + protected $middleware = []; |
|
| 68 | + |
|
| 69 | + /** |
|
| 70 | + * The router instance. |
|
| 71 | + * |
|
| 72 | + * @var \Syscodes\Routing\Router $router |
|
| 73 | + */ |
|
| 74 | + protected $router; |
|
| 75 | + |
|
| 76 | + /** |
|
| 77 | + * Total app execution time. |
|
| 78 | + * |
|
| 79 | + * @var float $totalTime |
|
| 80 | + */ |
|
| 81 | + protected $totalTime; |
|
| 82 | + |
|
| 83 | + /** |
|
| 84 | + * Constructor. Lenevor class instance. |
|
| 85 | + * |
|
| 86 | + * @param \Syscodes\Contracts\Core\Application $app |
|
| 87 | + * @param \Syscodes\Routing\Router $router |
|
| 88 | + * |
|
| 89 | + * @return void |
|
| 90 | + */ |
|
| 91 | + public function __construct(Application $app, Router $router) |
|
| 92 | + { |
|
| 93 | + $this->app = $app; |
|
| 94 | + $this->router = $router; |
|
| 95 | + } |
|
| 96 | 96 | |
| 97 | - /** |
|
| 98 | - * Initializes the framework, this can only be called once. |
|
| 99 | - * Launch the application. |
|
| 100 | - * |
|
| 101 | - * @param \Syscodes\http\Request $request |
|
| 102 | - * |
|
| 103 | - * @return \Syscodes\Http\Response |
|
| 104 | - */ |
|
| 105 | - public function handle($request) |
|
| 106 | - { |
|
| 107 | - try { |
|
| 108 | - $response = $this->sendRequestThroughRouter($request); |
|
| 109 | - } catch (Throwable $e) { |
|
| 110 | - $this->reportException($e); |
|
| 111 | - |
|
| 112 | - $response = $this->renderException($request, $e); |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - return $response; |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - /** |
|
| 119 | - * Send the given request through the router. |
|
| 120 | - * |
|
| 121 | - * @param \Syscodes\Http\Request $request |
|
| 122 | - * |
|
| 123 | - * @return \Syscodes\Http\Response |
|
| 124 | - */ |
|
| 125 | - protected function sendRequestThroughRouter($request) |
|
| 126 | - { |
|
| 127 | - $this->app->instance('request', $request); |
|
| 128 | - |
|
| 129 | - Facade::clearResolvedInstance('request'); |
|
| 130 | - |
|
| 131 | - // Load configuration system |
|
| 132 | - $this->bootstrap(); |
|
| 133 | - |
|
| 134 | - return (new Pipeline($this->app)) |
|
| 135 | - ->send($request) |
|
| 136 | - ->through($this->app->skipGoingMiddleware() ? [] : $this->middleware) |
|
| 137 | - ->then($this->dispatchToRouter()); |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - /** |
|
| 141 | - * Bootstrap the application for HTTP requests. |
|
| 142 | - * |
|
| 143 | - * @return void |
|
| 144 | - */ |
|
| 145 | - protected function bootstrap() |
|
| 146 | - { |
|
| 147 | - if ( ! $this->app->hasBeenBootstrapped()) { |
|
| 148 | - $this->app->bootstrapWith($this->bootstrappers()); |
|
| 149 | - } |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - /** |
|
| 153 | - * Get the bootstrap classes for the application. |
|
| 154 | - * |
|
| 155 | - * @return array |
|
| 156 | - */ |
|
| 157 | - protected function bootstrappers() |
|
| 158 | - { |
|
| 159 | - return $this->bootstrappers; |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - /** |
|
| 163 | - * Get the dispatcher of routes. |
|
| 164 | - * |
|
| 165 | - * @return \Closure |
|
| 166 | - */ |
|
| 167 | - protected function dispatchToRouter() |
|
| 168 | - { |
|
| 169 | - return function ($request) { |
|
| 170 | - $this->app->instance('request', $request); |
|
| 171 | - |
|
| 172 | - return $this->router->dispatch($request); |
|
| 173 | - }; |
|
| 174 | - } |
|
| 175 | - |
|
| 176 | - /** |
|
| 177 | - * Report the exception to the exception handler. |
|
| 178 | - * |
|
| 179 | - * @param \Throwable $e |
|
| 180 | - * |
|
| 181 | - * @return void |
|
| 182 | - */ |
|
| 183 | - protected function reportException(Throwable $e) |
|
| 184 | - { |
|
| 185 | - return $this->app[ExceptionHandler::class]->report($e); |
|
| 186 | - } |
|
| 97 | + /** |
|
| 98 | + * Initializes the framework, this can only be called once. |
|
| 99 | + * Launch the application. |
|
| 100 | + * |
|
| 101 | + * @param \Syscodes\http\Request $request |
|
| 102 | + * |
|
| 103 | + * @return \Syscodes\Http\Response |
|
| 104 | + */ |
|
| 105 | + public function handle($request) |
|
| 106 | + { |
|
| 107 | + try { |
|
| 108 | + $response = $this->sendRequestThroughRouter($request); |
|
| 109 | + } catch (Throwable $e) { |
|
| 110 | + $this->reportException($e); |
|
| 111 | + |
|
| 112 | + $response = $this->renderException($request, $e); |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + return $response; |
|
| 116 | + } |
|
| 117 | + |
|
| 118 | + /** |
|
| 119 | + * Send the given request through the router. |
|
| 120 | + * |
|
| 121 | + * @param \Syscodes\Http\Request $request |
|
| 122 | + * |
|
| 123 | + * @return \Syscodes\Http\Response |
|
| 124 | + */ |
|
| 125 | + protected function sendRequestThroughRouter($request) |
|
| 126 | + { |
|
| 127 | + $this->app->instance('request', $request); |
|
| 128 | + |
|
| 129 | + Facade::clearResolvedInstance('request'); |
|
| 130 | + |
|
| 131 | + // Load configuration system |
|
| 132 | + $this->bootstrap(); |
|
| 133 | + |
|
| 134 | + return (new Pipeline($this->app)) |
|
| 135 | + ->send($request) |
|
| 136 | + ->through($this->app->skipGoingMiddleware() ? [] : $this->middleware) |
|
| 137 | + ->then($this->dispatchToRouter()); |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + /** |
|
| 141 | + * Bootstrap the application for HTTP requests. |
|
| 142 | + * |
|
| 143 | + * @return void |
|
| 144 | + */ |
|
| 145 | + protected function bootstrap() |
|
| 146 | + { |
|
| 147 | + if ( ! $this->app->hasBeenBootstrapped()) { |
|
| 148 | + $this->app->bootstrapWith($this->bootstrappers()); |
|
| 149 | + } |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + /** |
|
| 153 | + * Get the bootstrap classes for the application. |
|
| 154 | + * |
|
| 155 | + * @return array |
|
| 156 | + */ |
|
| 157 | + protected function bootstrappers() |
|
| 158 | + { |
|
| 159 | + return $this->bootstrappers; |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + /** |
|
| 163 | + * Get the dispatcher of routes. |
|
| 164 | + * |
|
| 165 | + * @return \Closure |
|
| 166 | + */ |
|
| 167 | + protected function dispatchToRouter() |
|
| 168 | + { |
|
| 169 | + return function ($request) { |
|
| 170 | + $this->app->instance('request', $request); |
|
| 171 | + |
|
| 172 | + return $this->router->dispatch($request); |
|
| 173 | + }; |
|
| 174 | + } |
|
| 175 | + |
|
| 176 | + /** |
|
| 177 | + * Report the exception to the exception handler. |
|
| 178 | + * |
|
| 179 | + * @param \Throwable $e |
|
| 180 | + * |
|
| 181 | + * @return void |
|
| 182 | + */ |
|
| 183 | + protected function reportException(Throwable $e) |
|
| 184 | + { |
|
| 185 | + return $this->app[ExceptionHandler::class]->report($e); |
|
| 186 | + } |
|
| 187 | 187 | |
| 188 | - /** |
|
| 189 | - * Render the exception to a response. |
|
| 190 | - * |
|
| 191 | - * @param \Syscodes\Http\Request $request |
|
| 192 | - * @param \Throwable $e |
|
| 193 | - * |
|
| 194 | - * @return \Syscodes\Http\Response |
|
| 195 | - */ |
|
| 196 | - protected function renderException($request, Throwable $e) |
|
| 197 | - { |
|
| 198 | - return $this->app[ExceptionHandler::class]->render($request, $e); |
|
| 199 | - } |
|
| 200 | - } |
|
| 201 | 188 | \ No newline at end of file |
| 189 | + /** |
|
| 190 | + * Render the exception to a response. |
|
| 191 | + * |
|
| 192 | + * @param \Syscodes\Http\Request $request |
|
| 193 | + * @param \Throwable $e |
|
| 194 | + * |
|
| 195 | + * @return \Syscodes\Http\Response |
|
| 196 | + */ |
|
| 197 | + protected function renderException($request, Throwable $e) |
|
| 198 | + { |
|
| 199 | + return $this->app[ExceptionHandler::class]->render($request, $e); |
|
| 200 | + } |
|
| 201 | + } |
|
| 202 | 202 | \ 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 |