CarbonatedServiceProvider   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 35
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 4 1
A setupConfig() 0 10 4
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