ImageServiceProvider::provides()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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 View Code Duplication
        $this->app['imagy'] = $this->app->share(function ($app) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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']);
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