OpenWeatherServiceProvider::boot()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
cc 1
eloc 3
c 2
b 1
f 0
nc 1
nop 0
dl 0
loc 6
rs 10
1
<?php
2
3
namespace Rawaby88\OpenWeatherMap\Providers;
4
5
use Illuminate\Support\ServiceProvider;
6
use Rawaby88\OpenWeatherMap\Clients\WeatherClient;
7
8
/**
9
 * Class OpenWeatherServiceProvider.
10
 */
11
class OpenWeatherServiceProvider extends ServiceProvider
12
{
13
    /**
14
     * Register any application services.
15
     *
16
     * @return void
17
     */
18
    public function register()
19
    {
20
        $this->app->singleton(WeatherClient::class, function () {
21
            return new WeatherClient(
22
                [
23
                    'base_uri' => config('open-weather.base_uri'),
24
                ]
25
            );
26
        });
27
28
        $this->mergeConfigFrom(__DIR__.'/../config/open-weather.php', 'open-weather');
29
    }
30
31
    /**
32
     * Bootstrap any application services.
33
     *
34
     * @return void
35
     */
36
    public function boot()
37
    {
38
        $this->publishes(
39
            [
40
                __DIR__.'/../config/open-weather.php' => base_path('config/open-weather.php'),
41
            ], 'config'
42
        );
43
    }
44
}
45