PricingServiceProvider   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 53
rs 10
c 0
b 0
f 0
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A bootConfig() 0 8 2
A register() 0 7 1
A provides() 0 3 1
A boot() 0 3 1
1
<?php
2
3
namespace UniSharp\Pricing;
4
5
use UniSharp\Pricing\Pricing;
6
use Illuminate\Pipeline\Pipeline;
7
use Illuminate\Support\ServiceProvider;
8
9
class PricingServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * Boot the services for the application.
13
     *
14
     * @return void
15
     */
16
    public function boot()
17
    {
18
        $this->bootConfig();
19
20
    }
21
22
    /**
23
     * Register any application services.
24
     *
25
     * @return void
26
     */
27
    public function register()
28
    {
29
        $this->app->singleton('pricing', function ($app) {
30
            return new Pricing(
31
                $app,
32
                new Pipeline($app),
33
                $app['config']['pricing.modules']
34
            );
35
        });
36
    }
37
38
    /**
39
     * Boot configure.
40
     *
41
     * @return void
42
     */
43
    protected function bootConfig()
44
    {
45
        $path = __DIR__ . '/config/pricing.php';
46
47
        $this->mergeConfigFrom($path, 'pricing');
48
49
        if (function_exists('config_path')) {
50
            $this->publishes([$path => config_path('pricing.php')]);
51
        }
52
    }
53
54
    /**
55
     * Get the services provided by the provider.
56
     *
57
     * @return array
58
     */
59
    public function provides()
60
    {
61
        return ['pricing'];
62
    }
63
}