Passed
Push — master ( 7c54d7...41926f )
by Zing
05:15
created

QueryBuilderServiceProvider::provides()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Zing\QueryBuilder;
6
7
use Illuminate\Foundation\Application as Laravel;
8
use Illuminate\Support\ServiceProvider;
9
use Laravel\Lumen\Application as Lumen;
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...
10
11
class QueryBuilderServiceProvider extends ServiceProvider
12
{
13 43
    public function boot(): void
14
    {
15 43
        if (! $this->app->runningInConsole()) {
16
            return;
17
        }
18
19 43
        if (! $this->app instanceof Laravel) {
20
            return;
21
        }
22
23 43
        $this->publishes([
24 43
            $this->getConfigPath() => config_path('query-builder.php'),
25 43
        ], 'config');
26 43
    }
27
28 43
    public function register(): void
29
    {
30 43
        $this->registerConfig();
31 43
    }
32
33 43
    protected function getConfigPath(): string
34
    {
35 43
        return __DIR__ . '/../config/query-builder.php';
36
    }
37
38 43
    protected function registerConfig(): void
39
    {
40 43
        if ($this->app instanceof Lumen) {
41
            $this->app->configure('query-builder');
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

41
            $this->app->/** @scrutinizer ignore-call */ 
42
                        configure('query-builder');

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...
42
        }
43
44 43
        $this->mergeConfigFrom($this->getConfigPath(), 'query-builder');
45 43
    }
46
}
47