Passed
Pull Request — master (#7)
by Koen
05:32
created

SPAServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 23
ccs 5
cts 5
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 6 1
A boot() 0 2 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Providers;
6
7
use App\SPA\UrlGenerator;
8
use Illuminate\Contracts\Config\Repository;
9
use Illuminate\Support\ServiceProvider;
10
11
final class SPAServiceProvider extends ServiceProvider
12
{
13
    /**
14
     * Register any application services.
15
     *
16
     * @return void
17
     * @throws \Illuminate\Contracts\Container\BindingResolutionException
18
     */
19 47
    public function register(): void
20
    {
21
        /** @var \Illuminate\Contracts\Config\Repository $config */
22 47
        $config = $this->app->make(Repository::class);
23
24 47
        $this->app->singleton(UrlGenerator::class, fn() => new UrlGenerator($config->get('spa.url')));
25 47
    }
26
27
    /**
28
     * Bootstrap any application services.
29
     *
30
     * @return void
31
     */
32 47
    public function boot(): void
33
    {
34
        //
35 47
    }
36
}
37