DarajaServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A boot() 0 39 2
A register() 0 10 1
1
<?php
2
3
namespace Savannabits\Daraja;
4
5
use Illuminate\Support\ServiceProvider;
6
7
class DarajaServiceProvider extends ServiceProvider
8
{
9
    /**
10
     * Bootstrap the application services.
11
     */
12
    public function boot()
13
    {
14
        /*
15
         * Optional methods to load your package assets
16
         */
17
        // $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'daraja');
18
        // $this->loadViewsFrom(__DIR__.'/../resources/views', 'daraja');
19
        // $this->loadMigrationsFrom(__DIR__.'/../database/migrations');
20
        // $this->loadRoutesFrom(__DIR__.'/routes.php');
21
22
        if ($this->app->runningInConsole()) {
23
            $this->publishes([
24
                __DIR__.'/../config/config.php' => config_path('daraja.php'),
25
            ], 'config');
26
27
            // Publishing mpesa certs.
28
            $this->publishes([
29
                __DIR__.'/../certs' => storage_path('mpesa'),
30
            ], 'certs');
31
32
            // Publishing the views.
33
            /*$this->publishes([
34
                __DIR__.'/../resources/views' => resource_path('views/vendor/daraja'),
35
            ], 'views');*/
36
37
            // Publishing assets.
38
            /*$this->publishes([
39
                __DIR__.'/../resources/assets' => public_path('vendor/daraja'),
40
            ], 'assets');*/
41
42
            // Publishing the translation files.
43
            /*$this->publishes([
44
                __DIR__.'/../resources/lang' => resource_path('lang/vendor/daraja'),
45
            ], 'lang');*/
46
47
            // Registering package commands.
48
            // $this->commands([]);
49
        }
50
    }
51
52
    /**
53
     * Register the application services.
54
     */
55
    public function register()
56
    {
57
        // Automatically apply the package configuration
58
        $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'daraja');
59
60
        // Register the main class to use with the facade
61
        $this->app->singleton('daraja', function () {
62
            return new Daraja;
63
        });
64
    }
65
}
66