PurifierServiceProvider   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Importance

Changes 6
Bugs 0 Features 0
Metric Value
eloc 12
c 6
b 0
f 0
dl 0
loc 57
rs 10
wmc 6

4 Methods

Rating   Name   Duplication   Size   Complexity  
A provides() 0 3 1
A boot() 0 6 3
A getConfigSource() 0 3 1
A register() 0 9 1
1
<?php namespace Mews\Purifier;
2
3
use Illuminate\Container\Container;
4
use Illuminate\Foundation\Application as LaravelApplication;
5
use Illuminate\Support\ServiceProvider;
6
use Laravel\Lumen\Application as LumenApplication;
0 ignored issues
show
Bug introduced by
The type Laravel\Lumen\Application was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
8
class PurifierServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Indicates if loading of the provider is deferred.
12
     *
13
     * @var bool
14
     */
15
    protected $defer = true;
16
17
    /**
18
     * Boot the service provider.
19
     *
20
     * @return null
21
     */
22
    public function boot()
23
    {
24
        if ($this->app instanceof LaravelApplication) {
0 ignored issues
show
introduced by
$this->app is never a sub-type of Illuminate\Foundation\Application.
Loading history...
25
            $this->publishes([$this->getConfigSource() => config_path('purifier.php')]);
26
        } elseif ($this->app instanceof LumenApplication) {
27
            $this->app->configure('purifier');
0 ignored issues
show
Bug introduced by
The method configure() does not exist on Tests\Laravel\App. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

27
            $this->app->/** @scrutinizer ignore-call */ 
28
                        configure('purifier');

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
        }
29
    }
30
31
    /**
32
     * Get the config source.
33
     * 
34
     * @return string
35
     */
36
    protected function getConfigSource()
37
    {
38
        return realpath(__DIR__.'/../config/purifier.php');
39
    }
40
41
    /**
42
     * Register the service provider.
43
     *
44
     * @return void
45
     */
46
    public function register()
47
    {
48
        $this->mergeConfigFrom($this->getConfigSource(), 'purifier');
0 ignored issues
show
Bug introduced by
The method mergeConfigFrom() does not exist on Mews\Purifier\PurifierServiceProvider. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

48
        $this->/** @scrutinizer ignore-call */ 
49
               mergeConfigFrom($this->getConfigSource(), 'purifier');

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...
49
        
50
        $this->app->singleton('purifier', function (Container $app) {
0 ignored issues
show
Bug introduced by
The method singleton() does not exist on Tests\Laravel\App. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

50
        $this->app->/** @scrutinizer ignore-call */ 
51
                    singleton('purifier', function (Container $app) {

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...
51
            return new Purifier($app['files'], $app['config']);
52
        });
53
54
        $this->app->alias('purifier', Purifier::class);
0 ignored issues
show
Bug introduced by
The method alias() does not exist on Tests\Laravel\App. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

54
        $this->app->/** @scrutinizer ignore-call */ 
55
                    alias('purifier', Purifier::class);

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...
55
    }
56
57
    /**
58
     * Get the services provided by the provider.
59
     *
60
     * @return array
61
     */
62
    public function provides()
63
    {
64
        return ['purifier'];
65
    }
66
}
67