DockerRegistryServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 20
c 0
b 0
f 0
wmc 2
lcom 1
cbo 2
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 6 1
A register() 0 10 1
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