SanctumauthstarterServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Importance

Changes 12
Bugs 0 Features 0
Metric Value
eloc 37
c 12
b 0
f 0
dl 0
loc 63
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 12 1
A boot() 0 30 2
1
<?php
2
3
namespace Ikechukwukalu\Sanctumauthstarter;
4
5
use App\Services\Auth\ThrottleRequestsService;
0 ignored issues
show
Bug introduced by
The type App\Services\Auth\ThrottleRequestsService 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\Contracts\Foundation\Application;
7
use Illuminate\Support\ServiceProvider;
8
use Ikechukwukalu\Sanctumauthstarter\Console\Commands\ControllersCommand;
9
use Ikechukwukalu\Sanctumauthstarter\Console\Commands\RoutesCommand;
10
use Ikechukwukalu\Sanctumauthstarter\Console\Commands\SetupCommand;
11
use Ikechukwukalu\Sanctumauthstarter\Console\Commands\TestsCommand;
12
13
class SanctumauthstarterServiceProvider extends ServiceProvider
14
{
15
    /**
16
     * Bootstrap the application services.
17
     *
18
     * @return void
19
     */
20
21
    public const LANG = __DIR__.'/lang';
22
    public const DB = __DIR__.'/migrations';
23
    public const VIEW = __DIR__.'/views';
24
    public const CONFIG = __DIR__.'/config/sanctumauthstarter.php';
25
    public const ACTION = __DIR__.'/.github/workflows';
26
27
    public function boot()
28
    {
29
        if ($this->app->runningInConsole()) {
30
            $this->commands([
31
                ControllersCommand::class,
32
                RoutesCommand::class,
33
                SetupCommand::class,
34
                TestsCommand::class
35
            ]);
36
        }
37
38
        $this->loadMigrationsFrom(self::DB);
39
        $this->loadViewsFrom(self::VIEW, 'sanctumauthstarter');
40
        $this->loadTranslationsFrom(self::LANG, 'sanctumauthstarter');
41
42
        $this->publishes([
43
            self::CONFIG => config_path('sanctumauthstarter.php'),
44
        ], 'sas-config');
45
        $this->publishes([
46
            self::DB => database_path('migrations'),
47
        ], 'sas-migrations');
48
        $this->publishes([
49
            self::LANG => lang_path('vendor/sanctumauthstarter'),
50
        ], 'sas-lang');
51
        $this->publishes([
52
            self::VIEW => resource_path('views/vendor/sanctumauthstarter'),
53
        ], 'sas-views');
54
        $this->publishes([
55
            self::ACTION => base_path('.github/workflows'),
56
        ], 'github');
57
    }
58
59
    /**
60
     * Register the application services.
61
     *
62
     * @return void
63
     */
64
    public function register()
65
    {
66
        $this->mergeConfigFrom(
67
            __DIR__.'/config/sanctumauthstarter.php', 'sanctumauthstarter'
68
        );
69
70
        $this->app->register(EventServiceProvider::class);
71
72
        $this->app->bind(ThrottleRequestsService::class, function (Application $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

72
        $this->app->bind(ThrottleRequestsService::class, function (/** @scrutinizer ignore-unused */ Application $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...
73
            return new ThrottleRequestsService(
74
                config('sanctumauthstarter.login.maxAttempts', 3),
75
                config('sanctumauthstarter.login.delayMinutes', 1)
76
            );
77
        });
78
    }
79
}
80