ServiceProvider   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Importance

Changes 5
Bugs 0 Features 1
Metric Value
eloc 17
c 5
b 0
f 1
dl 0
loc 62
rs 10
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A registerRoutes() 0 4 1
A provides() 0 5 1
A boot() 0 23 2
A routeConfiguration() 0 5 1
1
<?php
2
3
namespace InShore\Bookwhen;
4
5
use Illuminate\Foundation\Console\AboutCommand;
0 ignored issues
show
Bug introduced by
The type Illuminate\Foundation\Console\AboutCommand 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...
6
use Illuminate\Support\Facades\Route;
0 ignored issues
show
Bug introduced by
The type Illuminate\Support\Facades\Route 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
use Illuminate\Support\ServiceProvider as BaseServiceProvider;
0 ignored issues
show
Bug introduced by
The type Illuminate\Support\ServiceProvider 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...
8
use InShore\Bookwhen\Bookwhen;
9
10
class ServiceProvider extends BaseServiceProvider
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function boot(): void
16
    {
17
18
        // About
19
        AboutCommand::add('Bookwhen', fn () => ['Version' => '1.0.0']);
20
21
        // Bind
22
        $this->app->bind('bookwhen', function ($app) {
0 ignored issues
show
Unused Code introduced by
The parameter $app is not used and could be removed. ( Ignorable by Annotation )

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

22
        $this->app->bind('bookwhen', function (/** @scrutinizer ignore-unused */ $app) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
23
            return new Bookwhen(config('bookwhen.api_key'));
0 ignored issues
show
Bug introduced by
The function config was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

23
            return new Bookwhen(/** @scrutinizer ignore-call */ config('bookwhen.api_key'));
Loading history...
24
        });
25
26
        // Config
27
        if ($this->app->runningInConsole()) {
28
            $this->publishes([
29
                __DIR__ . '/../config/bookwhen.php' => config_path('bookwhen.php')
0 ignored issues
show
Bug introduced by
The function config_path was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

29
                __DIR__ . '/../config/bookwhen.php' => /** @scrutinizer ignore-call */ config_path('bookwhen.php')
Loading history...
30
            ]);
31
        }
32
33
        // Routes
34
        $this->registerRoutes();
35
36
        // Views
37
        $this->loadViewsFrom(__DIR__.'/../resources/views', 'bookwhen');
38
39
    }
40
41
    /**
42
     * Get the services provided by the provider.
43
     *
44
     * @return array<int, string>
45
     */
46
    public function provides(): array
47
    {
48
        return [
49
            Bookwhen::class,
50
            'bookwhen',
51
        ];
52
    }
53
54
    /**
55
     *
56
     */
57
    protected function registerRoutes()
58
    {
59
        Route::group($this->routeConfiguration(), function () {
60
            $this->loadRoutesFrom(__DIR__.'/../routes/web.php');
61
        });
62
    }
63
64
    /**
65
     *
66
     */
67
    protected function routeConfiguration(): array
68
    {
69
        return [
70
            'prefix' => config('bookwhen.prefix'),
0 ignored issues
show
Bug introduced by
The function config was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

70
            'prefix' => /** @scrutinizer ignore-call */ config('bookwhen.prefix'),
Loading history...
71
            'middleware' => config('bookwhen.middleware'),
72
        ];
73
    }
74
75
}
76