Update   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
eloc 12
dl 0
loc 56
c 0
b 0
f 0
ccs 13
cts 13
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getEndpoint() 0 3 1
A getContentType() 0 3 1
A getMethod() 0 3 1
A getParams() 0 3 1
A __construct() 0 5 1
1
<?php
2
3
namespace Xsolve\SalesforceClient\Request;
4
5
use Xsolve\SalesforceClient\Enum\AbstractSObjectType;
6
use Xsolve\SalesforceClient\Enum\ContentType;
7
use Xsolve\SalesforceClient\Enum\RequestMethod;
8
9
class Update implements RequestInterface
10
{
11
    const ENDPOINT = '/sobjects/%s/%s/';
12
13
    /**
14
     * @var AbstractSObjectType
15
     */
16
    protected $objectType;
17
18
    /**
19
     * @var string
20
     */
21
    protected $id;
22
23
    /**
24
     * @var array
25
     */
26
    protected $params;
27
28 2
    public function __construct(AbstractSObjectType $objectType, string $id, array $params = [])
29
    {
30 2
        $this->objectType = $objectType;
31 2
        $this->id = $id;
32 2
        $this->params = $params;
33 2
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38 1
    public function getEndpoint(): string
39
    {
40 1
        return sprintf(self::ENDPOINT, $this->objectType->value(), $this->id);
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46 1
    public function getMethod(): RequestMethod
47
    {
48 1
        return RequestMethod::PATCH();
49
    }
50
51
    /**
52
     * {@inheritdoc}
53
     */
54 1
    public function getParams(): array
55
    {
56 1
        return $this->params;
57
    }
58
59
    /**
60
     * {@inheritdoc}
61
     */
62 1
    public function getContentType(): ContentType
63
    {
64 1
        return ContentType::JSON();
65
    }
66
}
67