ZohoCliqServiceProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

2 Methods

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