Completed
Push — master ( fb5b4c...bb722b )
by Nate
02:04
created

ContactMutatorCriteria::delete()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 0
cts 11
cp 0
rs 9.8666
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 2
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 ContactMutatorCriteria 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