ServiceProvider   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 6
Bugs 0 Features 0
Metric Value
wmc 8
eloc 17
c 6
b 0
f 0
dl 0
loc 43
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A bootPublishes() 0 5 1
A register() 0 3 1
A boot() 0 4 1
A bootCommands() 0 7 1
A isLumen() 0 3 2
A config() 0 8 2
1
<?php
2
3
namespace Helldar\LaravelLangPublisher;
4
5
use Helldar\LaravelLangPublisher\Console\LangInstall;
6
use Helldar\LaravelLangPublisher\Console\LangReset;
7
use Helldar\LaravelLangPublisher\Console\LangUninstall;
8
use Helldar\LaravelLangPublisher\Console\LangUpdate;
9
use Helldar\LaravelLangPublisher\Support\Config;
10
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
11
use Laravel\Lumen\Application;
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...
12
13
final class ServiceProvider extends BaseServiceProvider
14
{
15
    public function boot(): void
16
    {
17
        $this->bootPublishes();
18
        $this->bootCommands();
19
    }
20
21
    public function register(): void
22
    {
23
        $this->config();
24
    }
25
26
    protected function bootCommands(): void
27
    {
28
        $this->commands([
29
            LangInstall::class,
30
            LangUpdate::class,
31
            LangUninstall::class,
32
            LangReset::class,
33
        ]);
34
    }
35
36
    protected function bootPublishes(): void
37
    {
38
        $this->publishes([
39
            __DIR__ . '/../config/lang-publisher.php' => $this->app->configPath('lang-publisher.php'),
40
        ], 'config');
41
    }
42
43
    protected function config(): void
44
    {
45
        if ($this->isLumen()) {
46
            $this->app->configure(Config::KEY);
0 ignored issues
show
Bug introduced by
The method configure() does not exist on Illuminate\Contracts\Foundation\Application. Did you maybe mean configPath()? ( Ignorable by Annotation )

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

46
            $this->app->/** @scrutinizer ignore-call */ 
47
                        configure(Config::KEY);

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...
47
        }
48
49
        $this->mergeConfigFrom(__DIR__ . '/../config/lang-publisher.php', Config::KEY);
50
        $this->mergeConfigFrom(__DIR__ . '/../config/settings.php', Config::KEY_PRIVATE);
51
    }
52
53
    protected function isLumen(): bool
54
    {
55
        return class_exists(Application::class) && $this->app instanceof Application;
56
    }
57
}
58