ImgixServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 39
ccs 18
cts 18
cp 1
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 10 1
A register() 0 17 1
1
<?php
2
3
namespace Nasyrov\Laravel\Imgix;
4
5
use Illuminate\Support\ServiceProvider;
6
use Imgix\ShardStrategy;
7
use Imgix\UrlBuilder;
8
9
class ImgixServiceProvider extends ServiceProvider
10
{
11
    const ALIAS = 'imgix';
12
13
    /**
14
     * Bootstrap any application services.
15
     */
16 9
    public function boot()
17
    {
18 9
        $configFile = dirname(__DIR__) . '/config/imgix.php';
19
20 9
        $this->mergeConfigFrom($configFile, static::ALIAS);
21
22 9
        $this->publishes([
23 9
            $configFile => config_path('imgix.php'),
24 9
        ], static::ALIAS);
25 9
    }
26
27
    /**
28
     * Register any application services.
29
     */
30 9
    public function register()
31
    {
32
        $this->app->singleton(UrlBuilder::class, function () {
33 6
            return new UrlBuilder(
34 6
                config('imgix.domain'),
35 6
                config('imgix.useHttps', false),
36 6
                config('imgix.signKey', ''),
37 6
                config('imgix.includeLibraryParam', true)
38
            );
39 9
        });
40
41
        $this->app->singleton(Imgix::class, function ($app) {
42 6
            return new Imgix($app[ UrlBuilder::class ]);
43 9
        });
44
45 9
        $this->app->alias(Imgix::class, static::ALIAS);
46 9
    }
47
}
48