Issues (78)

src/RequirePinServiceProvider.php (10 issues)

1
<?php
2
3
namespace Ikechukwukalu\Requirepin;
4
5
use Config;
6
use Ikechukwukalu\Requirepin\Services\PinService;
7
use Ikechukwukalu\Requirepin\Services\ThrottleRequestsService;
8
use Ikechukwukalu\Requirepin\Middleware\RequirePin;
9
use Illuminate\Contracts\Foundation\Application;
10
use Illuminate\Support\ServiceProvider;
11
use Illuminate\Support\Facades\Route;
12
use Illuminate\Routing\Router;
13
14
class RequirePinServiceProvider extends ServiceProvider
15
{
16
    public const LANG = __DIR__.'/lang';
17
    public const DB = __DIR__.'/migrations';
18
    public const VIEW = __DIR__.'/views';
19
    public const CONFIG = __DIR__.'/config/requirepin.php';
20
    public const ROUTE_API = __DIR__.'/routes/api.php';
21
    public const ROUTE_WEB = __DIR__.'/routes/web.php';
22
23
    /**
24
     * Bootstrap the application services.
25
     *
26
     * @return void
27
     */
28
    public function boot()
29
    {
30
        $router = $this->app->make(Router::class);
0 ignored issues
show
The method make() does not exist on Tests\Laravel\App. ( Ignorable by Annotation )

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

30
        /** @scrutinizer ignore-call */ 
31
        $router = $this->app->make(Router::class);

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...
31
        $router->aliasMiddleware('require.pin', RequirePin::class);
32
33
        Route::middleware('api')->prefix('api')->group(function () {
34
            $this->loadRoutesFrom(static::ROUTE_API);
0 ignored issues
show
The method loadRoutesFrom() does not exist on Ikechukwukalu\Requirepin\RequirePinServiceProvider. ( Ignorable by Annotation )

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

34
            $this->/** @scrutinizer ignore-call */ 
35
                   loadRoutesFrom(static::ROUTE_API);

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...
35
        });
36
37
        Route::middleware('web')->group(function () {
38
            $this->loadRoutesFrom(static::ROUTE_WEB);
39
        });
40
41
        $this->loadMigrationsFrom(static::DB);
0 ignored issues
show
The method loadMigrationsFrom() does not exist on Ikechukwukalu\Requirepin\RequirePinServiceProvider. ( 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->/** @scrutinizer ignore-call */ 
42
               loadMigrationsFrom(static::DB);

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
        $this->loadViewsFrom(static::VIEW, 'requirepin');
0 ignored issues
show
The method loadViewsFrom() does not exist on Ikechukwukalu\Requirepin\RequirePinServiceProvider. ( Ignorable by Annotation )

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

42
        $this->/** @scrutinizer ignore-call */ 
43
               loadViewsFrom(static::VIEW, 'requirepin');

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...
43
        $this->loadTranslationsFrom(static::LANG, 'requirepin');
0 ignored issues
show
The method loadTranslationsFrom() does not exist on Ikechukwukalu\Requirepin\RequirePinServiceProvider. ( Ignorable by Annotation )

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

43
        $this->/** @scrutinizer ignore-call */ 
44
               loadTranslationsFrom(static::LANG, 'requirepin');

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...
44
45
        $this->publishes([
0 ignored issues
show
The method publishes() does not exist on Ikechukwukalu\Requirepin\RequirePinServiceProvider. ( Ignorable by Annotation )

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

45
        $this->/** @scrutinizer ignore-call */ 
46
               publishes([

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...
46
            static::CONFIG => config_path('requirepin.php'),
47
        ], 'rp-config');
48
        $this->publishes([
49
            static::DB => database_path('migrations'),
50
        ], 'rp-migrations');
51
        $this->publishes([
52
            static::LANG => lang_path('vendor/requirepin'),
53
        ], 'rp-lang');
54
        $this->publishes([
55
            static::VIEW => resource_path('views/vendor/requirepin'),
56
        ], 'rp-views');
57
    }
58
59
    /**
60
     * Register the application services.
61
     *
62
     * @return void
63
     */
64
    public function register()
65
    {
66
        $this->mergeConfigFrom(
0 ignored issues
show
The method mergeConfigFrom() does not exist on Ikechukwukalu\Requirepin\RequirePinServiceProvider. ( Ignorable by Annotation )

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

66
        $this->/** @scrutinizer ignore-call */ 
67
               mergeConfigFrom(

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...
67
            static::CONFIG, 'require-pin'
68
        );
69
70
        $this->app->make(\Ikechukwukalu\Requirepin\Controllers\PinController::class);
71
72
        $this->app->bind(ThrottleRequestsService::class, function (Application $app) {
0 ignored issues
show
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...
The method bind() does not exist on Tests\Laravel\App. ( Ignorable by Annotation )

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

72
        $this->app->/** @scrutinizer ignore-call */ 
73
                    bind(ThrottleRequestsService::class, function (Application $app) {

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...
73
            return new ThrottleRequestsService(
74
                config('sanctumauthstarter.login.maxAttempts', 3),
75
                config('sanctumauthstarter.login.delayMinutes', 1)
76
            );
77
        });
78
79
        $this->app->bind('PinService', PinService::class);
80
81
        $appConfig = Config::get('app');
82
        $packageFacades = [
83
            'PinService' => \Ikechukwukalu\Clamavfileupload\Facades\Foundation\PinService::class,
0 ignored issues
show
The type Ikechukwukalu\Clamavfile...s\Foundation\PinService 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...
84
        ];
85
        $appConfig['aliases'] = array_merge($appConfig['aliases'], $packageFacades);
86
        Config::set('app', $appConfig);
87
    }
88
}
89