RealtimeCompilerServiceProvider   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 12
dl 0
loc 26
rs 10
c 2
b 0
f 0
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 8 2
A boot() 0 12 3
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
use Hyde\RealtimeCompiler\Console\Commands\ServeCommand;
13
14
class RealtimeCompilerServiceProvider extends ServiceProvider
15
{
16
    public function register(): void
17
    {
18
        $this->app->singleton(RealtimeCompiler::class);
19
20
        if ($this->app->runningInConsole()) {
21
            $this->commands([
22
                HerdInstallCommand::class,
23
                ServeCommand::class,
24
            ]);
25
        }
26
    }
27
28
    public function boot(): void
29
    {
30
        $router = $this->app->make(RealtimeCompiler::class);
31
32
        $router->registerVirtualRoute('/ping', [VirtualRouteController::class, 'ping']);
33
34
        if (DashboardController::enabled()) {
35
            $router->registerVirtualRoute('/dashboard', [VirtualRouteController::class, 'dashboard']);
36
        }
37
38
        if (LiveEditController::enabled()) {
39
            $router->registerVirtualRoute('/_hyde/live-edit', [VirtualRouteController::class, 'liveEdit']);
40
        }
41
    }
42
}
43