Completed
Push — master ( 515139...fcdc06 )
by Dan Michael O.
19:00
created

CoverCacheServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 5
dl 0
loc 37
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 12 1
A provides() 0 4 1
1
<?php
2
3
namespace Colligator\Providers;
4
5
use Colligator\CoverCache;
6
use Illuminate\Support\ServiceProvider;
7
use Intervention\Image\ImageManager;
8
use League\Flysystem\Config as FlysystemConfig;
9
10
class CoverCacheServiceProvider extends ServiceProvider
11
{
12
	/**
13
     * Indicates if loading of the provider is deferred.
14
     *
15
     * @var bool
16
     */
17
    protected $defer = true;
18
19
    /**
20
     * Register the service provider.
21
     *
22
     * @return void
23
     */
24
    public function register()
25
    {
26
        $this->app->singleton(CoverCache::class, function ($app) {
0 ignored issues
show
Unused Code introduced by
The parameter $app is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
27
            $fs = \Storage::disk('s3')->getAdapter();
0 ignored issues
show
Bug introduced by
The method getAdapter() does not seem to exist on object<Illuminate\Contra...\Filesystem\Filesystem>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
28
            $im = $this->app->make(ImageManager::class);
29
            $conf = new FlysystemConfig([
30
                // Default: 30 days
0 ignored issues
show
Unused Code Comprehensibility introduced by
43% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
31
                'CacheControl' => 'max-age=' . env('IMAGE_CACHE_TIME', 3153600) . ', public',
32
            ]);
33
            return new CoverCache($fs, $im, $conf);
34
        });
35
    }
36
37
    /**
38
     * Get the services provided by the provider.
39
     *
40
     * @return array
41
     */
42
    public function provides()
43
    {
44
        return [CoverCache::class];
45
    }
46
}
47