RealtimeCompilerServiceProvider::boot()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 6
c 0
b 0
f 0
nc 4
nop 0
dl 0
loc 12
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Hyde\RealtimeCompiler;
6
7
use Illuminate\Support\ServiceProvider;
8
use Hyde\RealtimeCompiler\Http\DashboardController;
0 ignored issues
show
Bug introduced by
The type Hyde\RealtimeCompiler\Http\DashboardController 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use Hyde\RealtimeCompiler\Http\LiveEditController;
10
use Hyde\RealtimeCompiler\Http\VirtualRouteController;
11
use Hyde\RealtimeCompiler\Console\Commands\HerdInstallCommand;
12
13
class RealtimeCompilerServiceProvider extends ServiceProvider
14
{
15
    public function register(): void
16
    {
17
        $this->app->singleton(RealtimeCompiler::class);
18
19
        if ($this->app->runningInConsole()) {
20
            $this->commands([
21
                HerdInstallCommand::class,
22
            ]);
23
        }
24
    }
25
26
    public function boot(): void
27
    {
28
        $router = $this->app->make(RealtimeCompiler::class);
29
30
        $router->registerVirtualRoute('/ping', [VirtualRouteController::class, 'ping']);
31
32
        if (DashboardController::enabled()) {
33
            $router->registerVirtualRoute('/dashboard', [VirtualRouteController::class, 'dashboard']);
34
        }
35
36
        if (LiveEditController::enabled()) {
37
            $router->registerVirtualRoute('/_hyde/live-edit', [VirtualRouteController::class, 'liveEdit']);
38
        }
39
    }
40
}
41