Completed
Push — master ( 36c99b...955472 )
by Manuel
07:33
created

InetworxServiceProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 1
cbo 3
dl 0
loc 33
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 8 2
A register() 0 15 1
1
<?php
2
3
namespace Strebl\Inetworx;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class InetworxServiceProvider extends ServiceProvider
8
{
9
    /**
10
     * Bootstrap the application services.
11
     */
12
    public function boot()
13
    {
14
        if ($this->app->runningInConsole()) {
15
            $this->publishes([
16
                __DIR__.'/../config/inetworx.php' => config_path('inetworx.php'),
17
            ], 'config');
18
        }
19
    }
20
21
    /**
22
     * Register the application services.
23
     */
24
    public function register()
25
    {
26
        $this->mergeConfigFrom(__DIR__.'/../config/inetworx.php', 'inetworx');
27
28
        $this->app->bind(InetworxClient::class, function () {
29
            return new InetworxClient(
30
                config('inetworx.auth.credentials.auth_header.username'),
31
                config('inetworx.auth.credentials.auth_header.password'),
32
                config('inetworx.auth.credentials.api.username'),
33
                config('inetworx.auth.credentials.api.password')
34
            );
35
        });
36
37
        $this->app->alias(InetworxClient::class, 'inetworx-client');
38
    }
39
}
40