CelcatWebAPIServiceProvider::bootInConsole()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 6
rs 10
cc 3
nc 2
nop 0
1
<?php
2
3
namespace neilherbertuk\celcatwebapi;
4
5
use Illuminate\Support\ServiceProvider;
6
use Illuminate\Foundation\Application as LaravelApplication;
7
8
/**
9
 * Class CelcatWebAPIServiceProvider
10
 * @package neilherbertuk\CelcatWebAPI
11
 */
12
class CelcatWebAPIServiceProvider extends ServiceProvider
13
{
14
    /**
15
     * Indicates if loading of the provider is deferred.
16
     *
17
     * @var bool
18
     */
19
    protected $defer = false;
20
21
    /**
22
     * Bootstrap the application services.
23
     *
24
     * @return void
25
     */
26
    public function boot()
27
    {
28
        $this->bootInConsole();
29
    }
30
31
    /**
32
     * Register the application services.
33
     *
34
     * @return void
35
     */
36
    public function register()
37
    {
38
        $this->mergeConfigFrom(
39
            __DIR__.'/Config/config.php',
40
            'celcat'
41
        );
42
43
        $this->app->singleton('CelcatWebAPI', function($app) {
44
            return new CelcatWebAPI($app['config']);
45
        });
46
    }
47
48
    /**
49
     *
50
     */
51
    protected function bootInConsole()
52
    {
53
        if ($this->app instanceof LaravelApplication && $this->app->runningInConsole()) {
54
            $this->publishes([
55
                __DIR__.'/Config/config.php' => config_path('celcat.php'),
56
            ], "config");
57
        }
58
    }
59
}
60