CarbonatedServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/*
3
 * Carbonated
4
 *
5
 * This File belongs to to Project Carbonated
6
 *
7
 * @author Oliver Kaufmann <[email protected]>
8
 * @version 1.0
9
 */
10
11
namespace ThisVessel;
12
13
use Illuminate\Foundation\Application as LaravelApplication;
14
use Illuminate\Support\ServiceProvider;
15
use Laravel\Lumen\Application as LumenApplication;
16
17
/**
18
 * This is the YourPackage service provider class.
19
 *
20
 * @author {{ author }}
21
 */
22
class CarbonatedServiceProvider extends ServiceProvider
23
{
24
    /**
25
     * Indicates if loading of the provider is deferred.
26
     *
27
     * @var bool
28
     */
29
    protected $defer = true;
30
31
    /**
32
     * Boot the service provider.
33
     *
34
     * @return void
35
     */
36
    public function boot()
37
    {
38
        $this->setupConfig();
39
    }
40
41
    /**
42
     * Setup the config.
43
     *
44
     * @return void
45
     */
46
    protected function setupConfig()
47
    {
48
        $source = realpath(__DIR__.'/../config/carbonated.php');
49
        if ($this->app instanceof LaravelApplication && $this->app->runningInConsole()) {
50
            $this->publishes([$source => config_path('carbonated.php')]);
51
        } elseif ($this->app instanceof LumenApplication) {
52
            $this->app->configure('carbonated');
53
        }
54
        $this->mergeConfigFrom($source, 'carbonated');
55
    }
56
}
57