Completed
Pull Request — master (#41)
by
unknown
02:46
created

ImageServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 19 1
A provides() 0 4 1
1
<?php namespace Modules\Media\Image;
2
3
use Illuminate\Foundation\AliasLoader;
4
use Illuminate\Support\ServiceProvider;
5
use Modules\Media\Image\Intervention\InterventionFactory;
6
7
class ImageServiceProvider extends ServiceProvider
8
{
9
    /**
10
     * Register the service provider.
11
     *
12
     * @return void
13
     */
14
    public function register()
15
    {
16
        $this->app->bind(
17
            'Modules\Media\Image\ImageFactoryInterface',
18
            'Modules\Media\Image\Intervention\InterventionFactory'
19
        );
20
21
        $this->app['imagy'] = $this->app->share(function ($app) {
22
            $factory = new InterventionFactory();
23
            $thumbnailManager = new ThumbnailsManager($app['config'], $app['modules']);
0 ignored issues
show
Unused Code introduced by
The call to ThumbnailsManager::__construct() has too many arguments starting with $app['modules'].

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
24
25
            return new Imagy($factory, $thumbnailManager, $app['config']);
0 ignored issues
show
Unused Code introduced by
The call to Imagy::__construct() has too many arguments starting with $app['config'].

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
26
        });
27
28
        $this->app->booting(function () {
29
            $loader = AliasLoader::getInstance();
30
            $loader->alias('Imagy', 'Modules\Media\Image\Facade\Imagy');
31
        });
32
    }
33
34
    /**
35
     * Get the services provided by the provider.
36
     *
37
     * @return array
38
     */
39
    public function provides()
40
    {
41
        return ['imagy'];
42
    }
43
}
44