Browse Source

Update display name for laravel/lumen (#6416)

* unify port

* optimize composer

* update display name for laravel/lumen

* simplify exception handler

Co-authored-by: 谢彪 <[email protected]>
Biao Xie 4 years ago
parent
commit
d86dece672

+ 8 - 22
frameworks/PHP/laravel/app/Exceptions/Handler.php

@@ -3,35 +3,21 @@
 namespace App\Exceptions;
 
 use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
+use Throwable;
 
 class Handler extends ExceptionHandler
 {
     /**
-     * A list of the exception types that are not reported.
+     * Render an exception into an HTTP response.
      *
-     * @var array
-     */
-    protected $dontReport = [
-        //
-    ];
-
-    /**
-     * A list of the inputs that are never flashed for validation exceptions.
-     *
-     * @var array
-     */
-    protected $dontFlash = [
-        'password',
-        'password_confirmation',
-    ];
-
-    /**
-     * Register the exception handling callbacks for the application.
+     * @param  \Illuminate\Http\Request  $request
+     * @param  \Throwable  $e
+     * @return \Symfony\Component\HttpFoundation\Response
      *
-     * @return void
+     * @throws \Throwable
      */
-    public function register()
+    public function render($request, Throwable $e)
     {
-        //
+        return response()->json(['message' => 'Oops, something went wrong']);
     }
 }

+ 2 - 2
frameworks/PHP/laravel/benchmark_config.json

@@ -20,7 +20,7 @@
 			"webserver": "nginx",
 			"os": "Linux",
 			"database_os": "Linux",
-			"display_name": "Laravel 5.6",
+			"display_name": "laravel",
 			"notes": "",
 			"versus": "php"
 		},
@@ -66,7 +66,7 @@
 			"webserver": "none",
 			"os": "Linux",
 			"database_os": "Linux",
-			"display_name": "laravel-s",
+			"display_name": "laravel-laravel-s",
 			"notes": "",
 			"versus": "swoole"
 		}

+ 16 - 39
frameworks/PHP/lumen/app/Exceptions/Handler.php

@@ -1,46 +1,23 @@
 <?php
+
 namespace App\Exceptions;
 
-use Illuminate\Auth\Access\AuthorizationException;
-use Illuminate\Database\Eloquent\ModelNotFoundException;
-use Illuminate\Validation\ValidationException;
 use Laravel\Lumen\Exceptions\Handler as ExceptionHandler;
-use Symfony\Component\HttpKernel\Exception\HttpException;
 use Throwable;
 
-class Handler extends ExceptionHandler {
-
-	/**
-	 * A list of the exception types that should not be reported.
-	 *
-	 * @var array
-	 */
-	protected $dontReport = [];
-
-	/**
-	 * Report or log an exception.
-	 *
-	 * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
-	 *
-	 * @param \Throwable $exception
-	 * @return void
-	 *
-	 * @throws \Exception
-	 */
-	public function report(Throwable $exception) {
-		parent::report($exception);
-	}
-
-	/**
-	 * Render an exception into an HTTP response.
-	 *
-	 * @param \Illuminate\Http\Request $request
-	 * @param \Throwable $exception
-	 * @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
-	 *
-	 * @throws \Throwable
-	 */
-	public function render($request, Throwable $exception) {
-		return parent::render($request, $exception);
-	}
+class Handler extends ExceptionHandler
+{
+    /**
+     * Render an exception into an HTTP response.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @param  \Throwable  $e
+     * @return \Symfony\Component\HttpFoundation\Response
+     *
+     * @throws \Throwable
+     */
+    public function render($request, Throwable $e)
+    {
+        return response()->json(['message' => 'Oops, something went wrong']);
+    }
 }

+ 2 - 2
frameworks/PHP/lumen/benchmark_config.json

@@ -21,7 +21,7 @@
 			"webserver": "nginx",
 			"os": "Linux",
 			"database_os": "Linux",
-			"display_name": "Lumen",
+			"display_name": "lumen",
 			"notes": "",
 			"versus": "php"
 		},
@@ -66,7 +66,7 @@
 			"webserver": "none",
 			"os": "Linux",
 			"database_os": "Linux",
-			"display_name": "laravel-s",
+			"display_name": "lumen-laravel-s",
 			"notes": "",
 			"versus": "swoole"
 		}