Passed
Push — master ( 7c5543...bc6bd7 )
by Austin
02:05
created

SecurityTxtServiceProvider::register()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
/**
3
 * src/SecurityTxtServiceProvider.php
4
 *
5
 * @package     laravel-security-txt
6
 * @author      Austin Heap <[email protected]>
7
 * @version     v0.3.0
8
 */
9
10
declare(strict_types=1);
11
12
namespace AustinHeap\Security\Txt;
13
14
/**
15
 * SecurityTxtServiceProvider
16
 *
17
 * @link        https://github.com/austinheap/laravel-security-txt
18
 * @link        https://packagist.org/packages/austinheap/laravel-security-txt
19
 * @link        https://austinheap.github.io/laravel-security-txt/classes/AustinHeap.Security.Txt.SecurityTxtServiceProvider.html
20
 */
21
class SecurityTxtServiceProvider extends \Illuminate\Support\ServiceProvider
22
{
23
24
    /**
25
     * Indicates if loading of the provider is deferred.
26
     *
27
     * @var bool
28
     */
29
    protected $defer = false;
30
31
    /**
32
     * Perform post-registration booting of services.
33
     *
34
     * @return void
35
     */
36
    public function boot()
37
    {
38
        $this->publishes([
39
            __DIR__ . '/config/security-txt.php' => config_path('security-txt.php'),
40
        ]);
41
42
        if (!$this->app->routesAreCached())
43
            require __DIR__ . '/routes/security-txt.php';
44
45
        if (!defined('LARAVEL_SECURITY_TXT_VERSION'))
46
            define('LARAVEL_SECURITY_TXT_VERSION', SecurityTxtHelper::VERSION);
47
    }
48
49
    /**
50
     * Register the service provider.
51
     *
52
     * @return void
53
     */
54
    public function register()
55
    {
56
        $this->mergeConfigFrom(
57
            __DIR__ . '/config/security-txt.php', 'security-txt'
58
        );
59
60
        $this->app->singleton('securitytxt', function () {
61
            return new SecurityTxtHelper;
62
        });
63
    }
64
65
}
66