Completed
Push — master ( 5c97e7...28953f )
by Dan Michael O.
02:14
created

GoogleBooksServiceProvider::provides()   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 Scriptotek\GoogleBooks;
4
5
use Illuminate\Foundation\Application;
6
use Illuminate\Support\ServiceProvider;
7
8
/**
9
 * Laravel 5 service provider
10
 */
11
class GoogleBooksServiceProvider extends ServiceProvider
12
{
13
    /**
14
     * Bootstrap the application events.
15
     *
16
     * @return void
17
     */
18
    public function boot()
19
    {
20
        $this->publishes([
21
            __DIR__ . '/../config/config.php' => config_path('googlebooks.php')
22
        ]);
23
    }
24
25
    /**
26
     * Register the service provider.
27
     *
28
     * @return void
29
     */
30
    public function register()
31
    {
32
        $app = $this->app;
33
        $this->mergeConfigFrom(
34
            __DIR__.'/../../config/config.php',
35
            'googlebooks'
36
        );
37
        $this->app->singleton('googlebooks', function ($app) {
38
            $options = [];
39
            $options['key'] = $app['config']->get('googlebooks.key');
40
41
            return new GoogleBooks($options);
42
        });
43
44
        $app->alias('googlebooks', GoogleBooks::class);
45
    }
46
47
    /**
48
     * Get the services provided by the provider.
49
     *
50
     * @return array
51
     */
52
    public function provides()
53
    {
54
        return ['googlebooks'];
55
    }
56
}
57