Completed
Pull Request — master (#2)
by Evgenii
04:55
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
     * @return void
15
     */
16
    public function boot()
17
    {
18
        $this->publishes([
19
            dirname(__DIR__) . '/config/imgix.php' => config_path('imgix.php'),
20
        ], 'laravel-imgix');
21
    }
22
23
    /**
24
     * Register any application services.
25
     *
26
     * @return void
27
     */
28
    public function register()
29
    {
30
        $this->app->singleton(UrlBuilder::class, function () {
31
            return new UrlBuilder(
32
                config('imgix.domains', []),
33
                config('imgix.useHttps', false),
34
                config('imgix.signKey', ''),
35
                config('imgix.shardStrategy', ShardStrategy::CRC),
36
                config('imgix.includeLibraryParam', true)
37
            );
38
        });
39
40
        $this->app->alias(UrlBuilder::class, 'imgix');
41
    }
42
}
43