SalesforceServiceProvider   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 4
dl 0
loc 43
rs 10
c 2
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 13 1
A provides() 0 4 1
1
<?php namespace Davispeixoto\Laravel5Salesforce;
2
3
use Illuminate\Support\ServiceProvider;
4
use Davispeixoto\ForceDotComToolkitForPhp\SforceEnterpriseClient as Client;
5
6
/**
7
 * Class SalesforceServiceProvider
8
 * @package Davispeixoto\Laravel5Salesforce
9
 *
10
 * The Laravel Service Provider for Salesforce Service
11
 */
12
class SalesforceServiceProvider extends ServiceProvider
13
{
14
    /**
15
     * Indicates if loading of the provider is deferred.
16
     *
17
     * @var bool
18
     */
19
    protected $defer = true;
20
21
    /**
22
     * @var
23
     */
24
    protected $sfh;
25
26
    /**
27
     * Register the service provider.
28
     *
29
     * @return void
30
     */
31
    public function register()
32
    {
33
        $config = __DIR__ . '/config/config.php';
34
        $this->mergeConfigFrom($config, 'salesforce');
35
        $this->publishes([$config => config_path('salesforce.php')]);
36
37
        $this->app->singleton('salesforce', function ($app) {
38
            $sf = new Salesforce(new Client());
39
            $sf->connect($app['config']);
40
41
            return $sf;
42
        });
43
    }
44
45
    /**
46
     * Get the services provided by the provider.
47
     *
48
     * @return array
49
     */
50
    public function provides()
51
    {
52
        return ['salesforce', 'Davispeixoto\Laravel5Salesforce\Salesforce'];
53
    }
54
}
55