Completed
Push — master ( fcd60f...7bc087 )
by Jean C.
02:05
created

MoipServiceProvider::isLumen()   A

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
namespace Artesaos\Moip\Providers;
4
5
use Artesaos\Moip\Moip;
6
use Illuminate\Support\ServiceProvider;
7
8
class MoipServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Indicates if loading of the provider is deferred.
12
     *
13
     * @var bool
14
     */
15
    protected $defer = true;
16
17
    /**
18
     * Bootstrap the application events.
19
     */
20
    public function boot()
21
    {
22
        $config_file = __DIR__.'/../../config/moip.php';
23
24
        if ($this->isLumen()) {
25
            $this->app->configure('moip');
0 ignored issues
show
Bug introduced by Jean C. Garcia
The method configure() does not exist on Illuminate\Contracts\Foundation\Application. Did you maybe mean registerConfiguredProviders()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
26
        } else {
27
            $this->publishes([$config_file => config_path('moip.php')]);
28
        }
29
30
        $this->mergeConfigFrom($config_file, 'moip');
31
    }
32
33
    /**
34
     * Register the service provider.
35
     */
36
    public function register()
37
    {
38
        $this->app->singleton('moip', Moip::class);
39
    }
40
41
    /**
42
     * Get the services provided by the provider.
43
     *
44
     * @return array
45
     */
46
    public function provides()
47
    {
48
        return ['moip'];
49
    }
50
51
    /**
52
     * @return bool
53
     */
54
    private function isLumen()
55
    {
56
        return true === str_contains($this->app->version(), 'Lumen');
57
    }
58
}
59