Completed
Push — master ( 6e9196...c55090 )
by Nate
02:30
created

ContactCriteriaMutator   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 75
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 75
ccs 0
cts 45
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 11 1
A update() 0 13 1
A upsert() 0 13 1
A delete() 0 12 1
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://github.com/flipbox/hubspot/blob/master/LICENSE.md
6
 * @link       https://github.com/flipbox/hubspot
7
 */
8
9
namespace Flipbox\HubSpot\Criteria;
10
11
use Flipbox\HubSpot\Resources\Contact;
12
use Psr\Http\Message\ResponseInterface;
13
14
/**
15
 * @author Flipbox Factory <[email protected]>
16
 * @since 2.0.0
17
 */
18
class ContactCriteriaMutator extends AbstractObjectMutator
19
{
20
    /**
21
     * @param array $criteria
22
     * @param array $config
23
     * @return ResponseInterface
24
     */
25
    public function create(array $criteria = [], array $config = []): ResponseInterface
26
    {
27
        $this->populate($criteria);
28
29
        return Contact::create(
30
            $this->getPayload(),
31
            $this->getConnection(),
32
            $this->getLogger(),
33
            $config
34
        );
35
    }
36
37
    /**
38
     * @param array $criteria
39
     * @param array $config
40
     * @return ResponseInterface
41
     */
42
    public function update(array $criteria = [], array $config = []): ResponseInterface
43
    {
44
        $this->populate($criteria);
45
46
        return Contact::update(
47
            $this->getPayload(),
48
            $this->getId(),
49
            $this->getConnection(),
50
            $this->getCache(),
51
            $this->getLogger(),
52
            $config
53
        );
54
    }
55
56
    /**
57
     * @param array $criteria
58
     * @param array $config
59
     * @return ResponseInterface
60
     */
61
    public function upsert(array $criteria = [], array $config = []): ResponseInterface
62
    {
63
        $this->populate($criteria);
64
65
        return Contact::upsert(
66
            $this->getPayload(),
67
            $this->getId(),
68
            $this->getConnection(),
69
            $this->getCache(),
70
            $this->getLogger(),
71
            $config
72
        );
73
    }
74
75
    /**
76
     * @param array $criteria
77
     * @param array $config
78
     * @return ResponseInterface
79
     */
80
    public function delete(array $criteria = [], array $config = []): ResponseInterface
81
    {
82
        $this->populate($criteria);
83
84
        return Contact::delete(
85
            $this->getId(),
86
            $this->getConnection(),
87
            $this->getCache(),
88
            $this->getLogger(),
89
            $config
90
        );
91
    }
92
}
93