Completed
Pull Request — master (#18)
by
unknown
01:31
created

ServiceProvider::isLumen()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace RichanFongdasen\EloquentBlameable;
4
5
use Illuminate\Support\ServiceProvider as Provider;
6
7
class ServiceProvider extends Provider
8
{
9
    /**
10
     * Check if the application runs with Lumen.
11
     *
12
     * @return bool
13
     */
14
    protected function isLumen()
15
    {
16
        return strpos($this->app->version(), 'Lumen') !== false;
17
    }
18
19
    /**
20
     * Bootstrap the application services.
21
     *
22
     * @return void
23
     */
24
    public function boot()
25
    {
26
        if (!$this->isLumen()) {
27
            $this->publishes([
28
                realpath(__DIR__ . '/../config/blameable.php') => config_path('blameable.php'),
29
            ], 'config');
30
        }
31
    }
32
33
    /**
34
     * Register the application services.
35
     *
36
     * @return void
37
     */
38
    public function register()
39
    {
40
        $this->mergeConfigFrom(realpath(__DIR__ . '/../config/blameable.php'), 'blameable');
41
42
        $this->app->singleton(BlameableObserver::class, function () {
43
            return new BlameableObserver();
44
        });
45
46
        $this->app->singleton(BlameableService::class, function () {
47
            return new BlameableService();
48
        });
49
    }
50
}
51