ka4ivan /
laravel-api-debugger
| 1 | <?php |
||||||
| 2 | |||||||
| 3 | declare(strict_types=1); |
||||||
| 4 | |||||||
| 5 | namespace Ka4ivan\ApiDebugger; |
||||||
| 6 | |||||||
| 7 | use Illuminate\Http\Request; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 8 | use Illuminate\Routing\Router; |
||||||
|
0 ignored issues
–
show
The type
Illuminate\Routing\Router 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...
|
|||||||
| 9 | use Ka4ivan\ApiDebugger\Middleware\ApiDebuggerMiddleware; |
||||||
| 10 | use Ka4ivan\ApiDebugger\Support\ApiDebugger; |
||||||
| 11 | |||||||
| 12 | class ServiceProvider extends \Illuminate\Support\ServiceProvider |
||||||
| 13 | { |
||||||
| 14 | /** |
||||||
| 15 | * Bootstrap the application services. |
||||||
| 16 | * |
||||||
| 17 | * @return void |
||||||
| 18 | */ |
||||||
| 19 | public function boot(): void |
||||||
| 20 | { |
||||||
| 21 | $this->registerMacros(); |
||||||
| 22 | $this->registerMiddleware(); |
||||||
| 23 | |||||||
| 24 | if (app(ApiDebugger::class)->isActive()) { |
||||||
|
0 ignored issues
–
show
The function
app 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...
|
|||||||
| 25 | $this->startDebug(); |
||||||
| 26 | } |
||||||
| 27 | } |
||||||
| 28 | |||||||
| 29 | /** |
||||||
| 30 | * Register the application services. |
||||||
| 31 | * |
||||||
| 32 | * @return void |
||||||
| 33 | */ |
||||||
| 34 | public function register(): void |
||||||
| 35 | { |
||||||
| 36 | $this->app->singleton(ApiDebugger::class); |
||||||
| 37 | } |
||||||
| 38 | |||||||
| 39 | /** |
||||||
| 40 | * Register macros for Request class. |
||||||
| 41 | * |
||||||
| 42 | * @return void |
||||||
| 43 | */ |
||||||
| 44 | protected function registerMacros(): void |
||||||
| 45 | { |
||||||
| 46 | Request::macro('startDebug', fn() => app(ApiDebugger::class)->startDebug()); |
||||||
|
0 ignored issues
–
show
The function
app 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...
|
|||||||
| 47 | Request::macro('getDebug', fn() => app(ApiDebugger::class)->getDebug(request())); |
||||||
|
0 ignored issues
–
show
The function
request 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...
The function
app 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...
|
|||||||
| 48 | } |
||||||
| 49 | |||||||
| 50 | /** |
||||||
| 51 | * Register middleware for API routes. |
||||||
| 52 | * |
||||||
| 53 | * @return void |
||||||
| 54 | */ |
||||||
| 55 | protected function registerMiddleware(): void |
||||||
| 56 | { |
||||||
| 57 | $this->app->booted(fn() => tap($this->app->make(Router::class), function(Router $router) { |
||||||
| 58 | $router->middlewareGroup('api', array_merge( |
||||||
| 59 | $router->getMiddlewareGroups()['api'] ?? [], |
||||||
| 60 | [ApiDebuggerMiddleware::class] |
||||||
| 61 | )); |
||||||
| 62 | })); |
||||||
| 63 | } |
||||||
| 64 | |||||||
| 65 | /** |
||||||
| 66 | * Start Debugging |
||||||
| 67 | * |
||||||
| 68 | * @return void |
||||||
| 69 | */ |
||||||
| 70 | protected function startDebug(): void |
||||||
| 71 | { |
||||||
| 72 | $this->app->booted(function () { |
||||||
| 73 | app(ApiDebugger::class)->startDebug(); |
||||||
|
0 ignored issues
–
show
The function
app 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...
|
|||||||
| 74 | }); |
||||||
| 75 | } |
||||||
| 76 | } |
||||||
| 77 |
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