Completed
Push — master ( 0c0d2f...7c0457 )
by Nate
04:27
created

AddContact   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 36
ccs 0
cts 14
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 12 1
A getPath() 0 4 1
1
<?php
2
3
namespace Flipbox\Relay\HubSpot\Middleware\Companies;
4
5
use Psr\Http\Message\RequestInterface;
6
use Psr\Http\Message\ResponseInterface;
7
8
class AddContact extends AbstractCompany
9
{
10
    /**
11
     * @var int
12
     */
13
    public $id;
14
15
    /**
16
     * @var int
17
     */
18
    public $contactId;
19
20
    /**
21
     * @inheritdoc
22
     */
23
    public function __invoke(
24
        RequestInterface $request,
25
        ResponseInterface $response,
26
        callable $next = null
27
    ) {
28
        // Prepare request
29
        $request = $this->prepareUri(
30
            $request->withMethod('PUT')
31
        );
32
33
        return $next($request, $response);
34
    }
35
36
    /**
37
     * @return string
38
     */
39
    protected function getPath(): string
40
    {
41
        return "companies/{$this->id}/contacts/{$this->contactId}";
42
    }
43
}
44