TmdbServiceProviderLaravel5::setupConfiguration()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
/**
3
 * @package php-tmdb\laravel
4
 * @author Mark Redeman <[email protected]>
5
 * @copyright (c) 2014, Mark Redeman
6
 */
7
namespace Tmdb\Laravel;
8
9
use Illuminate\Support\ServiceProvider;
10
11
class TmdbServiceProviderLaravel5 extends ServiceProvider {
12
13
    /**
14
     * Bootstrap the application events.
15
     *
16
     * @return void
17
     */
18
    public function boot()
19
    {
20
        $this->publishes([
21
            $this->defaultConfig() => config_path('tmdb.php'),
22
        ]);
23
    }
24
25
    /**
26
     * Register the service provider.
27
     *
28
     * @return void
29
     */
30
    public function register()
31
    {
32
        $this->setupConfiguration();
33
34
        $this->app->bind('Tmdb\Laravel\Adapters\EventDispatcherAdapter', 'Tmdb\Laravel\Adapters\EventDispatcherLaravel5');
35
    }
36
37
    /**
38
     * Get the TMDB configuration from the config repository
39
     *
40
     * @return array
41
     */
42
    public function config()
43
    {
44
        return $this->app['config']->get('tmdb');
45
    }
46
47
    /**
48
     * Setup configuration
49
     *
50
     * @return  void
51
     */
52
    private function setupConfiguration()
53
    {
54
        $config = $this->defaultConfig();
55
        $this->mergeConfigFrom($config, 'tmdb');
56
    }
57
58
    /**
59
     * Returns the default configuration path
60
     *
61
     * @return string
62
     */
63
    private function defaultConfig()
64
    {
65
        return __DIR__ . '/config/tmdb.php';
66
    }
67
}
68