Test Failed
Branch feature__set_up_scrutinizer (ea6624)
by Robin
06:04 queued 02:46
created

AppServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace App\Providers;
4
5
use App\Porter;
6
use App\Support\Console\Cli;
7
use App\Support\Console\ConsoleWriter;
8
use App\Support\Console\ServerBag;
9
use App\Support\Contracts\Cli as CliContract;
10
use App\Support\Contracts\ImageSetRepository as ImageSetRepositoryContract;
11
use App\Support\Images\ImageSetRepository;
12
use App\Support\Ssl\CertificateBuilder;
13
use Illuminate\Support\ServiceProvider;
14
15
class AppServiceProvider extends ServiceProvider
16
{
17
    /**
18
     * Bootstrap any application services.
19
     */
20 50
    public function boot(): void
21
    {
22 50
        view()->getFinder()->prependLocation(config('porter.library_path').'/views');
23 50
    }
24
25
    /**
26
     * Register any application services.
27
     */
28 50
    public function register(): void
29
    {
30
        $this->app->singleton(ServerBag::class, function () {
31 50
            return new ServerBag;
32 50
        });
33
        $this->app->bind(CliContract::class, function () {
34 50
            return new Cli;
35 50
        });
36
        $this->app->bind(ImageSetRepositoryContract::class, function () {
37 50
            return (new ImageSetRepository)->addLocation(config('porter.library_path').'/docker');
38 50
        });
39
40 50
        $this->app->singleton(Porter::class);
41 50
        $this->app->singleton(ConsoleWriter::class);
42
        $this->app->singleton(CertificateBuilder::class, function () {
43 5
            return new CertificateBuilder(config('porter.library_path') . '/ssl');
44 50
        });
45
46 50
        $this->publishes([resource_path('stubs/config') => config('porter.library_path').'/config']);
47 50
    }
48
}
49