HubPlannerProvider   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 1
lcom 1
cbo 4

1 Method

Rating   Name   Duplication   Size   Complexity  
B boot() 0 27 1
1
<?php
2
namespace AlfredNutileInc\HPClient;
3
4
use Illuminate\Support\ServiceProvider;
5
use GuzzleHttp\Client;
6
7
class HubPlannerProvider extends ServiceProvider
8
{
9
10
    public function boot()
11
    {
12
13
        $this->publishes([
14
            __DIR__ . '/../hpconfig.php' => config_path('hpconfig.php'),
15
        ]);
16
17
        $this->mergeConfigFrom(
18
            __DIR__ . '/../hpconfig.php',
19
            'hpconfig'
20
        );
21
22
        $this->app->singleton(
23
            HubPlannerClient::class,
24
            function () {
25
                $client = new \GuzzleHttp\Client([
26
                    'base_uri' => 'https://api.hubplanner.com/',
27
                    'headers' => [
28
                        'Authorization' => config('hpconfig.key'),
29
                        'Accept' => 'application/json',
30
                        'Content-Type' => 'application/json'
31
                    ]
32
                ]);
33
                return new HubPlannerClient($client);
34
            }
35
        );
36
    }
37
}
38