FirewallServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 8
nc 1
nop 0
dl 0
loc 12
ccs 0
cts 11
cp 0
crap 2
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Someshwer\Firewall;
4
5
use Illuminate\Support\Facades\Event;
0 ignored issues
show
Bug introduced by
The type Illuminate\Support\Facades\Event 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\ServiceProvider;
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...
7
use Someshwer\Firewall\Commands\BlackListCommand;
8
use Someshwer\Firewall\Commands\WhitelistCommand;
9
use Someshwer\Firewall\Lib\Firewall;
10
use Someshwer\Firewall\src\Commands\AcceptAndRejectListCommand;
11
use Someshwer\Firewall\src\Events\NotifyException;
12
use Someshwer\Firewall\src\Listeners\HandleNotifyException;
13
use Someshwer\Firewall\src\Repo\FirewallRepository;
14
15
/**
16
 * Class FirewallServiceProvider.
17
 */
18
class FirewallServiceProvider extends ServiceProvider
19
{
20
    /**
21
     * Register any application services.
22
     *
23
     * @return void
24
     */
25
    public function register()
26
    {
27
        $this->app->bind('firewall', function () {
28
            return new Firewall(new FirewallRepository());
29
        });
30
31
        // Registering event listeners
32
        $this->registerEventListeners();
33
    }
34
35
    /**
36
     * Bootstrap any application services.
37
     *
38
     * @return void
39
     */
40
    public function boot()
41
    {
42
        $this->publishes([__DIR__.'/config/firewall.php' => config_path('firewall_old.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

42
        $this->publishes([__DIR__.'/config/firewall.php' => /** @scrutinizer ignore-call */ config_path('firewall_old.php')]);
Loading history...
43
        $this->loadRoutesFrom(__DIR__.'\routes\routes.php');
44
        // $this->app['router']->aliasMiddleware('firewall', FirewallMiddleware::class);
45
        $this->commands([
46
            BlackListCommand::class,
47
            WhitelistCommand::class,
48
            AcceptAndRejectListCommand::class,
49
        ]);
50
        $this->loadViewsFrom(__DIR__.'/Resources/views', 'package_redirect');
51
        $this->publishes([__DIR__.'/Migrations' => $this->app->databasePath().'/migrations'], 'migrations');
52
    }
53
54
    /**
55
     * Register event listeners.
56
     */
57
    private function registerEventListeners()
58
    {
59
        Event::listen(NotifyException::class, HandleNotifyException::class);
60
    }
61
}
62