Passed
Push — master ( 14ed89...8aec5a )
by Nicolaas
01:56
created

SalesforceTest::createContact()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 8
rs 10
c 1
b 0
f 0
1
<?php
2
3
4
use SForce\Client\Partner;
5
6
use SForce\SObject;
7
8
use SForce\Wsdl\create;
9
10
class SalesforceTest extends BuildTask
11
{
12
    protected $title = 'Test Sales Force API';
13
14
    protected $description = 'Test Sales Cloud';
15
16
    protected $email = '@test.best.co.com.org.net';
17
18
    public function run($request)
19
    {
20
        MySalesforceContactApi::set_debug(true);
21
22
        $this->email = 'test'.rand(0,99999).$this->email;
23
24
        $this->findContact();
25
        $this->createContact();
26
        $this->updateContact();
27
    }
28
29
    protected function createContact()
30
    {
31
        MySalesforceContactApi::create_contact(
32
            [
33
                'FirstName' => 'John',
34
                'LastName' => 'Smith',
35
                'Phone' => '(510) 555-5555',
36
                'Email' => $this->email,
37
            ]
38
        );
39
    }
40
41
    protected function updateContact()
42
    {
43
        MySalesforceContactApi::update_contact(
44
            [
45
                'FirstName' => 'Joan',
46
                'LastName' => 'Smith',
47
                'Phone' => '(510) 555-5555',
48
                'Email' => $this->email,
49
            ]
50
        );
51
    }
52
53
    protected function findContact()
54
    {
55
        $contact = MySalesforceContactApi::retrieve_contact($this->email);
0 ignored issues
show
Bug introduced by
$this->email of type string is incompatible with the type array expected by parameter $fieldsArray of MySalesforceContactApi::retrieve_contact(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

55
        $contact = MySalesforceContactApi::retrieve_contact(/** @scrutinizer ignore-type */ $this->email);
Loading history...
Unused Code introduced by
The assignment to $contact is dead and can be removed.
Loading history...
56
    }
57
58
59
}
60