Completed
Push — master ( 4b871d...3ef7e6 )
by Davis
07:40
created

src/Davispeixoto/Laravel5Salesforce/Salesforce.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php namespace Davispeixoto\Laravel5Salesforce;
2
3
use Davispeixoto\ForceDotComToolkitForPhp\SforceEnterpriseClient as Client;
4
use Exception;
5
use Illuminate\Config\Repository;
6
7
/**
8
 * Class Salesforce
9
 * @package Davispeixoto\Laravel5Salesforce
10
 *
11
 * The Salesforce service accessor Constructor
12
 */
13
class Salesforce
14
{
15
    /**
16
     * @var Client
17
     */
18
    public $sfh;
19
20
    public function __construct(Repository $configExternal)
21
    {
22
        $this->sfh = new Client();
23
24
        $wsdl = $configExternal->get('salesforce.wsdl');
25
26
        if (empty($wsdl)) {
27
            $wsdl = __DIR__ . '/Wsdl/enterprise.wsdl.xml';
28
        }
29
30
        $user = $configExternal->get('salesforce.username');
31
        $pass = $configExternal->get('salesforce.password');
32
        $token = $configExternal->get('salesforce.token');
33
34
        try {
35
            $this->sfh->createConnection($wsdl);
36
            $this->sfh->login($user, $pass . $token);
37
        } catch (Exception $e) {
38
            throw new SalesforceException('Exception at Constructor' . $e->getMessage() . "\n\n" . $e->getTraceAsString());
39
        }
40
    }
41
42
    public function __call($method, $args)
43
    {
44
        return call_user_func_array([$this->sfh, $method], $args);
45
    }
46
47
    /*
48
     * Debugging functions
49
     */
50
51
    /**
52
     * @return mixed
53
     */
54
    public function dump()
55
    {
56
        return print_r($this, true);
57
    }
58
}
0 ignored issues
show
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
59