Completed
Push — master ( ec2e49...6f427d )
by Quetzy
06:31
created

AuditingServiceProvider::provides()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * This file is part of the Laravel Auditing package.
4
 *
5
 * @author     Antério Vieira <[email protected]>
6
 * @author     Quetzy Garcia  <[email protected]>
7
 * @author     Raphael França <[email protected]>
8
 * @copyright  2015-2018
9
 *
10
 * For the full copyright and license information,
11
 * please view the LICENSE.md file that was distributed
12
 * with this source code.
13
 */
14
15
namespace OwenIt\Auditing;
16
17
use Illuminate\Support\ServiceProvider;
18
use OwenIt\Auditing\Console\AuditDriverMakeCommand;
19
use OwenIt\Auditing\Console\AuditTableCommand;
20
use OwenIt\Auditing\Console\InstallCommand;
21
use OwenIt\Auditing\Contracts\Auditor;
22
23
class AuditingServiceProvider extends ServiceProvider
24
{
25
    /**
26
     * {@inheritdoc}
27
     */
28
    protected $defer = true;
29
30
    /**
31
     * Bootstrap the service provider.
32
     *
33
     * @return void
34
     */
35 273
    public function boot()
36
    {
37 273
        $config = realpath(__DIR__).'/../config/audit.php';
38
39 273
        if ($this->app->runningInConsole()) {
40 273
            $this->publishes([
41 273
                $config => base_path('config/audit.php'),
42
            ]);
43
        }
44
45 273
        $this->mergeConfigFrom($config, 'audit');
46 273
    }
47
48
    /**
49
     * Register the service provider.
50
     *
51
     * @return void
52
     */
53 273
    public function register()
54
    {
55 273
        $this->commands([
56 273
            AuditTableCommand::class,
57
            AuditDriverMakeCommand::class,
58
            InstallCommand::class,
59
        ]);
60
61 273
        $this->app->singleton(Auditor::class, function ($app) {
62 129
            return new \OwenIt\Auditing\Auditor($app);
63 273
        });
64 273
    }
65
66
    /**
67
     * {@inheritdoc}
68
     */
69 3
    public function provides()
70
    {
71
        return [
72 3
            Auditor::class,
73
        ];
74
    }
75
}
76