Test Failed
Branch master (52949b)
by Artem
05:53
created

ServiceProvider::normalizeConfigParameters()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Slides\Saml2;
4
5
/**
6
 * Class ServiceProvider
7
 *
8
 * @package Slides\Saml2
9
 */
10
class ServiceProvider extends \Illuminate\Support\ServiceProvider
11
{
12
    /**
13
     * Indicates if loading of the provider is deferred.
14
     *
15
     * @var bool
16
     */
17
    protected $defer = false;
18
19
    /**
20
     * Bootstrap the application events.
21
     *
22
     * @return void
23
     */
24
    public function boot()
25
    {
26
        $this->bootMiddleware();
27
        $this->bootRoutes();
28
        $this->bootPublishes();
29
        $this->bootCommands();
30
        $this->loadMigrations();
31
    }
32
33
    /**
34
     * Bootstrap the routes.
35
     *
36
     * @return void
37
     */
38
    protected function bootRoutes()
39
    {
40
        if($this->app['config']['saml2.useRoutes'] == true) {
41
            include __DIR__ . '/Http/routes.php';
42
        }
43
    }
44
45
    /**
46
     * Bootstrap the publishable files.
47
     *
48
     * @return void
49
     */
50
    protected function bootPublishes()
51
    {
52
        $this->publishes([
53
            __DIR__ . '/../config/saml2.php' => config_path('saml2.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

53
            __DIR__ . '/../config/saml2.php' => /** @scrutinizer ignore-call */ config_path('saml2.php'),
Loading history...
54
        ]);
55
    }
56
57
    /**
58
     * Bootstrap the console commands.
59
     *
60
     * @return void
61
     */
62
    protected function bootCommands()
63
    {
64
        $this->commands([
65
            \Slides\Saml2\Commands\CreateTenant::class,
66
            \Slides\Saml2\Commands\UpdateTenant::class,
67
            \Slides\Saml2\Commands\DeleteTenant::class,
68
            \Slides\Saml2\Commands\RestoreTenant::class,
69
            \Slides\Saml2\Commands\ListTenants::class,
70
            \Slides\Saml2\Commands\TenantCredentials::class
71
        ]);
72
    }
73
74
    /**
75
     * Bootstrap the console commands.
76
     *
77
     * @return void
78
     */
79
    protected function bootMiddleware()
80
    {
81
        $this->app['router']->aliasMiddleware('saml2.resolveTenant', \Slides\Saml2\Http\Middleware\ResolveTenant::class);
82
    }
83
84
    /**
85
     * Load the package migrations.
86
     *
87
     * @return void
88
     */
89
    protected function loadMigrations()
90
    {
91
        $this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
92
    }
93
94
    /**
95
     * Get the services provided by the provider.
96
     *
97
     * @return array
98
     */
99
    public function provides()
100
    {
101
        return [];
102
    }
103
}
104