DockerRegistryServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Josepostiga\DockerRegistry;
4
5
use Illuminate\Foundation\Application;
6
use Illuminate\Support\ServiceProvider;
7
use Josepostiga\DockerRegistry\Contracts\DockerRegistryClientInterface;
8
9
class DockerRegistryServiceProvider extends ServiceProvider
10
{
11
    public function boot(): void
12
    {
13
        $this->publishes([
14
            __DIR__.'/../config/config.php' => config_path('docker-registry.php'),
15
        ], 'config');
16
    }
17
18
    public function register(): void
19
    {
20
        $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'docker-registry');
21
22
        $this->app->singleton(DockerRegistryClientInterface::class, function (Application $app) {
23
            $config = $app->config->get('docker-registry');
24
25
            return new $config['service']($config['url'], $config['port'], $config['version']);
26
        });
27
    }
28
}
29