ka4ivan /
laravel-api-debugger
| 1 | <?php |
||||
| 2 | |||||
| 3 | declare(strict_types=1); |
||||
| 4 | |||||
| 5 | namespace Ka4ivan\ApiDebugger\Middleware; |
||||
| 6 | |||||
| 7 | use Closure; |
||||
| 8 | use Illuminate\Http\Request; |
||||
|
0 ignored issues
–
show
|
|||||
| 9 | use Illuminate\Http\Response; |
||||
|
0 ignored issues
–
show
The type
Illuminate\Http\Response was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||
| 10 | use Illuminate\Http\JsonResponse; |
||||
|
0 ignored issues
–
show
The type
Illuminate\Http\JsonResponse was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||
| 11 | |||||
| 12 | class ApiDebuggerMiddleware |
||||
| 13 | { |
||||
| 14 | /** |
||||
| 15 | * Handle an incoming request. |
||||
| 16 | * |
||||
| 17 | * @param Request $request |
||||
| 18 | * @param \Closure $next |
||||
| 19 | * @return Response |
||||
| 20 | */ |
||||
| 21 | public function handle(Request $request, Closure $next) |
||||
| 22 | { |
||||
| 23 | $response = $next($request); |
||||
| 24 | |||||
| 25 | if (!$request->expectsJson() || !config('app.debug', false)) { |
||||
|
0 ignored issues
–
show
The function
config 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...
|
|||||
| 26 | return $response; |
||||
| 27 | } |
||||
| 28 | |||||
| 29 | if ($response instanceof JsonResponse) { |
||||
| 30 | $response->setData(array_merge($response->getData(true), $request->getDebug())); |
||||
| 31 | } |
||||
| 32 | |||||
| 33 | return $response; |
||||
| 34 | } |
||||
| 35 | } |
||||
| 36 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths