PrestashopWebServiceProvider::provides()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace DansMaCulotte\PrestashopWebService;
4
5
use Illuminate\Contracts\Support\DeferrableProvider;
6
use Illuminate\Support\ServiceProvider;
7
8
class PrestashopWebServiceProvider extends ServiceProvider implements DeferrableProvider
9
{
10
    /**
11
     * Bootstrap the application services.
12
     *
13
     * @return void
14
     */
15
    public function boot()
16
    {
17
        $this->mergeConfigFrom(__DIR__.'/../config/prestashop-webservice.php', 'prestashop-webservice');
18
19
        $this->publishes([
20
            __DIR__.'/../config/prestashop-webservice.php' => config_path('prestashop-webservice.php'),
21
        ]);
22
    }
23
24
    /**
25
     * Register the application services.
26
     *
27
     * @return void
28
     */
29
    public function register()
30
    {
31
        $this->app->singleton(PrestashopWebService::class, function () {
32
            return new PrestashopWebService(
33
                config('prestashop-webservice.url'),
34
                config('prestashop-webservice.token'),
35
                config('prestashop-webservice.debug')
36
            );
37
        });
38
39
        $this->app->alias(PrestashopWebService::class, 'prestashop-webservice');
40
    }
41
42
    public function provides()
43
    {
44
        return [PrestashopWebService::class];
45
    }
46
}
47