Completed
Push — develop ( 2e7b9b...10ff7a )
by Enea
05:13
created

AuthorizationServiceProvider::configDriver()   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 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created on 12/02/18 by enea dhack.
4
 */
5
6
namespace Enea\Authorization;
7
8
use Enea\Authorization\Contracts\PermissionContract;
9
use Enea\Authorization\Contracts\RoleContract;
10
use Enea\Authorization\Support\Config;
11
use Illuminate\Support\ServiceProvider;
12
13
class AuthorizationServiceProvider extends ServiceProvider
14
{
15
    /**
16
     * Bootstrap the application services.
17
     *
18
     * @return void
19
     */
20 47
    public function boot(): void
21
    {
22 47
        $this->publish();
23 47
    }
24
25
    /**
26
     * Register the application services.
27
     *
28
     * @return void
29
     */
30 47
    public function register(): void
31
    {
32 47
        $this->app->register(EventServiceProvider::class);
33 47
        $this->registerBindings();
34 47
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    public function provides()
40
    {
41
        return [
42
            Authorizer::class,
43
        ];
44
    }
45
46 47
    private function publish(): void
47
    {
48 47
        $this->publishes([
49 47
            __DIR__ . "/../database/migrations" => database_path('migrations'),
50 47
            __DIR__ . "/../config/authorization.php" => base_path('config/authorization.php')
51
        ]);
52 47
    }
53
54 47
    private function registerBindings(): void
55
    {
56 47
        $this->configDriver();
57 47
        $this->app->bind(PermissionContract::class, Config::permissionModel());
58 47
        $this->app->bind(RoleContract::class, Config::roleModel());
59 47
    }
60
61 47
    private function configDriver(): void
62
    {
63 47
        (new DriversResolver($this->app))->make();
64 47
    }
65
}
66