Completed
Push — master ( 6f2bbc...b76cb7 )
by Evgenii
13s
created

ImgixServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
dl 0
loc 34
ccs 0
cts 21
cp 0
rs 10
c 2
b 0
f 0
wmc 2
lcom 1
cbo 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 6 1
A register() 0 18 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
    /**
12
     * Bootstrap any application services.
13
     */
14
    public function boot()
15
    {
16
        $this->publishes([
17
            dirname(__DIR__) . '/config/imgix.php' => config_path('imgix.php'),
18
        ], 'imgix');
19
    }
20
21
    /**
22
     * Register any application services.
23
     */
24
    public function register()
25
    {
26
        $this->app->singleton(UrlBuilder::class, function () {
27
            return new UrlBuilder(
28
                config('imgix.domains', []),
29
                config('imgix.useHttps', false),
30
                config('imgix.signKey', ''),
31
                config('imgix.shardStrategy', ShardStrategy::CRC),
32
                config('imgix.includeLibraryParam', true)
33
            );
34
        });
35
36
        $this->app->singleton(Imgix::class, function ($app) {
37
            return new Imgix($app[UrlBuilder::class]);
38
        });
39
40
        $this->app->alias(Imgix::class, 'imgix');
41
    }
42
}
43