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

ImgixServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 6
ccs 0
cts 6
cp 0
crap 2
rs 9.4285
c 1
b 0
f 0
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