Passed
Push — master ( 8b2c6b...fdb328 )
by Andrey
03:16
created

ServiceProvider::isLumen()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 2
nc 2
nop 0
1
<?php
2
3
namespace Helldar\LaravelLangPublisher;
4
5
use Helldar\LaravelLangPublisher\Console\LangInstall;
6
use Helldar\LaravelLangPublisher\Console\LangUninstall;
7
use Helldar\LaravelLangPublisher\Console\LangUpdate;
8
use Helldar\LaravelLangPublisher\Support\Config;
9
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
10
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...
11
12
final class ServiceProvider extends BaseServiceProvider
13
{
14
    public function boot(): void
15
    {
16
        $this->bootPublishes();
17
        $this->bootCommands();
18
    }
19
20
    public function register(): void
21
    {
22
        $this->config();
23
    }
24
25
    protected function bootCommands(): void
26
    {
27
        $this->commands([
28
            LangInstall::class,
29
            LangUpdate::class,
30
            LangUninstall::class,
31
        ]);
32
    }
33
34
    protected function bootPublishes(): void
35
    {
36
        $this->publishes([
37
            __DIR__ . '/../config/lang-publisher.php' => $this->app->configPath('lang-publisher.php'),
38
        ], 'config');
39
    }
40
41
    protected function config(): void
42
    {
43
        if ($this->isLumen()) {
44
            $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

44
            $this->app->/** @scrutinizer ignore-call */ 
45
                        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...
45
        }
46
47
        $this->mergeConfigFrom(__DIR__ . '/../config/lang-publisher.php', Config::KEY);
48
    }
49
50
    protected function isLumen(): bool
51
    {
52
        return class_exists(Application::class) && $this->app instanceof Application;
53
    }
54
}
55