for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Exceptions\Api;
use Exception;
use Illuminate\Support\Facades\Lang;
class BadUrlException extends Exception
{
/**
* Constructor function.
*
* @param string $message Custom error message.
* @param integer $code HTTP code to return.
* @param \Throwable $previous The last exception thrown.
* @return void
*/
public function __construct(string $message = '', int $code = 0, ?\Throwable $previous = null)
$message = Lang::get('errors.bad_url');
$code = 422; // Unprocessable entity.
parent::__construct($message, $code, $previous);
}
* Render the exception into an HTTP response.
* @param \Illuminate\Http\Request $request Incoming request object.
* @return \Illuminate\Http\Response
public function render(\Illuminate\Http\Request $request)
$request
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function render(/** @scrutinizer ignore-unused */ \Illuminate\Http\Request $request)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
return response()->json(
response
If this is a false-positive, you can also ignore this issue in your code via the ignore-call annotation
ignore-call
return /** @scrutinizer ignore-call */ response()->json(
[
'message' => $this->getMessage()
],
$this->getCode()
);
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.