Completed
Pull Request — master (#2)
by Evgenii
04:55
created

ImgixServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

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

2 Methods

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