SruServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Scriptotek\Sru\Providers;
4
5
use Illuminate\Support\ServiceProvider;
6
use Scriptotek\Sru\Client as SruClient;
7
8
class SruServiceProvider 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
     * @return void
21
     */
22
    public function boot()
23
    {
24
        $this->publishes(array(
25
            __DIR__.'/../../config/config.php' => config_path('sru.php')
26
        ));
27
    }
28
29
    /**
30
     * Register the service provider.
31
     *
32
     * @return void
33
     */
34
    public function register()
35
    {
36
        $this->mergeConfigFrom(
37
            __DIR__.'/../../config/config.php',
38
            'sru'
39
        );
40
        $this->app->singleton(SruClient::class, function ($app) {
41
            return new SruClient($app['config']->get('sru.endpoint'), $app['config']->get('sru'));
42
        });
43
    }
44
45
    /**
46
     * Get the services provided by the provider.
47
     *
48
     * @return array
49
     */
50
    public function provides()
51
    {
52
        return [SruClient::class];
53
    }
54
}
55