GCTC-NTGC /
TalentCloud
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace App\Exceptions\Api; |
||||
| 4 | |||||
| 5 | use Exception; |
||||
| 6 | use Illuminate\Support\Facades\Lang; |
||||
| 7 | |||||
| 8 | class BadUrlException extends Exception |
||||
| 9 | { |
||||
| 10 | /** |
||||
| 11 | * Constructor function. |
||||
| 12 | * |
||||
| 13 | * @param string $message Custom error message. |
||||
| 14 | * @param integer $code HTTP code to return. |
||||
| 15 | * @param \Throwable $previous The last exception thrown. |
||||
| 16 | * |
||||
| 17 | * @return void |
||||
| 18 | */ |
||||
| 19 | public function __construct(string $message = '', int $code = 0, ?\Throwable $previous = null) |
||||
| 20 | { |
||||
| 21 | $message = Lang::get('errors.bad_url'); |
||||
| 22 | $code = 422; // Unprocessable entity. |
||||
| 23 | parent::__construct($message, $code, $previous); |
||||
| 24 | } |
||||
| 25 | |||||
| 26 | /** |
||||
| 27 | * Render the exception into an HTTP response. |
||||
| 28 | * |
||||
| 29 | * @param \Illuminate\Http\Request $request Incoming request object. |
||||
| 30 | * @return \Illuminate\Http\Response |
||||
| 31 | */ |
||||
| 32 | public function render(\Illuminate\Http\Request $request) |
||||
|
0 ignored issues
–
show
|
|||||
| 33 | { |
||||
| 34 | return response()->json( |
||||
|
0 ignored issues
–
show
The function
response was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 35 | [ |
||||
| 36 | 'message' => $this->getMessage() |
||||
| 37 | ], |
||||
| 38 | $this->getCode() |
||||
| 39 | ); |
||||
| 40 | } |
||||
| 41 | } |
||||
| 42 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.