From 1d0f921ff33d8419bae7e2afa8bd59cfc5255f14 Mon Sep 17 00:00:00 2001 From: Franck DAKIA Date: Tue, 16 May 2023 05:51:16 +0000 Subject: [PATCH 1/2] Remove extension require --- composer.json | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/composer.json b/composer.json index 6a406b2..82c28e5 100644 --- a/composer.json +++ b/composer.json @@ -16,16 +16,6 @@ }, "require": { "php": "^8.1", - "ext-intl": "*", - "ext-json": "*", - "ext-mbstring": "*", - "ext-openssl": "*", - "ext-pdo": "*", - "ext-pdo_mysql": "*", - "ext-pdo_pgsql": "*", - "ext-pdo_sqlite": "*", - "ext-redis": "*", - "ext-xml": "*", "bowphp/framework": "^5.0", "bowphp/meta-manager": "^1.0", "bowphp/policier": "^2.1" From 8cc6911d0b02b094633e40b7082e8e4f6ceeacbe Mon Sep 17 00:00:00 2001 From: Franck DAKIA Date: Tue, 16 May 2023 06:23:20 +0000 Subject: [PATCH 2/2] Add the application exception --- app/Exceptions/ErrorHandle.php | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/app/Exceptions/ErrorHandle.php b/app/Exceptions/ErrorHandle.php index dc3b0d2..bf2afce 100644 --- a/app/Exceptions/ErrorHandle.php +++ b/app/Exceptions/ErrorHandle.php @@ -5,21 +5,21 @@ use Exception; use PDOException; use Bow\Http\Exception\HttpException; -use Bow\Router\Exception\RouterException; use Policier\Exception\TokenExpiredException; use Policier\Exception\TokenInvalidException; +use Bow\Application\Exception\BaseErrorHandler; use Bow\Http\Exception\ResponseException as HttpResponseException; use Bow\Database\Exception\NotFoundException as ModelNotFoundException; -class ErrorHandle +class ErrorHandle extends BaseErrorHandler { /** * handle the error * * @param Exception $exception - * @return void + * @return mixed */ - public function handle(Exception $exception) + public function handle($exception): mixed { if (request()->isAjax()) { return $this->json($exception); @@ -41,23 +41,6 @@ public function handle(Exception $exception) } } - /** - * Render view as response - * - * @param string $view - * @param array $data - * @return mixed - */ - private function render($view, $data = [], $code = 200) - { - if (is_numeric($data)) { - $code = $data; - $data = []; - } - - return view($view, $data, $code); - } - /** * Send the json as response *