Completed
Pull Request — master (#1)
by Oliver
14:08
created

CarbonatedServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
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) {
1 ignored issue
show
Bug introduced by
The class Laravel\Lumen\Application does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
52
            $this->app->configure('carbonated');
53
        }
54
        $this->mergeConfigFrom($source, 'carbonated');
55
    }
56
}
57