Completed
Push — master ( 1ded7d...9c6ac2 )
by Nate
02:22
created

EmailSubscriptionCriteria::list()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 0
cts 10
cp 0
rs 9.9
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\EmailSubscriptions;
12
use Psr\Http\Message\ResponseInterface;
13
14
/**
15
 * @author Flipbox Factory <[email protected]>
16
 * @since 2.4.0
17
 */
18
class EmailSubscriptionCriteria extends AbstractCriteria
19
{
20
    use ConnectionTrait,
21
        CacheTrait,
22
        IdAttributeTrait,
23
        PayloadAttributeTrait;
24
25
    /**
26
     * @param array $criteria
27
     * @param array $config
28
     * @return ResponseInterface
29
     * @throws \Exception
30
     */
31
    public function list(array $criteria = [], array $config = []): ResponseInterface
32
    {
33
        $this->populate($criteria);
34
35
        return EmailSubscriptions::list(
36
            $this->getConnection(),
37
            $this->getCache(),
38
            $this->getLogger(),
39
            $config
40
        );
41
    }
42
43
    /**
44
     * @param array $criteria
45
     * @param array $config
46
     * @return ResponseInterface
47
     * @throws \Exception
48
     */
49
    public function read(array $criteria = [], array $config = []): ResponseInterface
50
    {
51
        $this->populate($criteria);
52
53
        return EmailSubscriptions::read(
54
            $this->getId(),
55
            $this->getConnection(),
56
            $this->getCache(),
57
            $this->getLogger(),
58
            $config
59
        );
60
    }
61
62
    /**
63
     * @param array $criteria
64
     * @param array $config
65
     * @return ResponseInterface
66
     * @throws \Exception
67
     */
68
    public function update(array $criteria = [], array $config = []): ResponseInterface
69
    {
70
        $this->populate($criteria);
71
72
        return EmailSubscriptions::update(
73
            $this->getId(),
74
            $this->getPayload(),
75
            $this->getConnection(),
76
            $this->getCache(),
77
            $this->getLogger(),
78
            $config
79
        );
80
    }
81
}
82