CompanyContacts::remove()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 17
c 0
b 0
f 0
ccs 0
cts 17
cp 0
rs 9.7
cc 1
nc 1
nop 6
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\Resources;
10
11
use Flipbox\HubSpot\Connections\ConnectionInterface;
12
use Flipbox\HubSpot\HubSpot;
13
use Flipbox\Relay\Builder\RelayBuilderInterface;
14
use Flipbox\Relay\HubSpot\Builder\Resources\Company\Contacts\Add;
15
use Flipbox\Relay\HubSpot\Builder\Resources\Company\Contacts\All;
16
use Flipbox\Relay\HubSpot\Builder\Resources\Company\Contacts\Remove;
17
use Psr\Http\Message\ResponseInterface;
18
use Psr\Log\LoggerInterface;
19
use Psr\SimpleCache\CacheInterface;
20
21
/**
22
 * @author Flipbox Factory <[email protected]>
23
 * @since 2.0.0
24
 */
25
class CompanyContacts
26
{
27
28
    /*******************************************
29
     * READ
30
     *******************************************/
31
32
    /**
33
     * @param string $identifier
34
     * @param ConnectionInterface|null $connection
35
     * @param CacheInterface|null $cache
36
     * @param LoggerInterface|null $logger
37
     * @param array $config
38
     * @return ResponseInterface
39
     */
40
    public static function all(
41
        string $identifier,
42
        ConnectionInterface $connection = null,
43
        CacheInterface $cache = null,
44
        LoggerInterface $logger = null,
45
        array $config = []
46
    ): ResponseInterface {
47
        return static::allRelay(
48
            $identifier,
49
            $connection,
50
            $cache,
51
            $logger,
52
            $config
53
        )();
54
    }
55
56
    /**
57
     * @param string $identifier
58
     * @param ConnectionInterface|null $connection
59
     * @param CacheInterface|null $cache
60
     * @param LoggerInterface|null $logger
61
     * @param array $config
62
     * @return callable
63
     */
64
    public static function allRelay(
65
        string $identifier,
66
        ConnectionInterface $connection = null,
67
        CacheInterface $cache = null,
68
        LoggerInterface $logger = null,
69
        array $config = []
70
    ): callable {
71
        $builder = new All(
72
            $identifier,
73
            $connection ?: HubSpot::getConnection(),
74
            $cache ?: HubSpot::getCache(),
75
            $logger ?: HubSpot::getLogger(),
76
            $config
77
        );
78
79
        return $builder->build();
80
    }
81
82
83
    /*******************************************
84
     * ADD
85
     *******************************************/
86
87
    /**
88
     * @param string $companyId
89
     * @param string $contactId
90
     * @param ConnectionInterface|null $connection
91
     * @param CacheInterface|null $cache
92
     * @param LoggerInterface|null $logger
93
     * @param array $config
94
     * @return ResponseInterface
95
     */
96
    public static function add(
97
        string $companyId,
98
        string $contactId,
99
        ConnectionInterface $connection = null,
100
        CacheInterface $cache = null,
101
        LoggerInterface $logger = null,
102
        array $config = []
103
    ): ResponseInterface {
104
        return static::addRelay(
105
            $companyId,
106
            $contactId,
107
            $connection,
108
            $cache,
109
            $logger,
110
            $config
111
        )();
112
    }
113
114
    /**
115
     * @param string $companyId
116
     * @param string $contactId
117
     * @param ConnectionInterface|null $connection
118
     * @param CacheInterface|null $cache
119
     * @param LoggerInterface|null $logger
120
     * @param array $config
121
     * @return callable
122
     */
123
    public static function addRelay(
124
        string $companyId,
125
        string $contactId,
126
        ConnectionInterface $connection = null,
127
        CacheInterface $cache = null,
128
        LoggerInterface $logger = null,
129
        array $config = []
130
    ): callable {
131
        /** @var RelayBuilderInterface $builder */
132
        $builder = new Add(
133
            $companyId,
134
            $contactId,
135
            $connection ?: HubSpot::getConnection(),
136
            $cache ?: HubSpot::getCache(),
137
            $logger ?: HubSpot::getLogger(),
138
            $config
139
        );
140
141
        return $builder->build();
142
    }
143
144
145
    /*******************************************
146
     * REMOVE
147
     *******************************************/
148
149
    /**
150
     * @param string $companyId
151
     * @param string $contactId
152
     * @param ConnectionInterface|null $connection
153
     * @param CacheInterface|null $cache
154
     * @param LoggerInterface|null $logger
155
     * @param array $config
156
     * @return ResponseInterface
157
     */
158
    public static function remove(
159
        string $companyId,
160
        string $contactId,
161
        ConnectionInterface $connection = null,
162
        CacheInterface $cache = null,
163
        LoggerInterface $logger = null,
164
        array $config = []
165
    ): ResponseInterface {
166
        return static::removeRelay(
167
            $companyId,
168
            $contactId,
169
            $connection,
170
            $cache,
171
            $logger,
172
            $config
173
        )();
174
    }
175
176
    /**
177
     * @param string $companyId
178
     * @param string $contactId
179
     * @param ConnectionInterface|null $connection
180
     * @param CacheInterface|null $cache
181
     * @param LoggerInterface|null $logger
182
     * @param array $config
183
     * @return callable
184
     */
185
    public static function removeRelay(
186
        string $companyId,
187
        string $contactId,
188
        ConnectionInterface $connection = null,
189
        CacheInterface $cache = null,
190
        LoggerInterface $logger = null,
191
        array $config = []
192
    ): callable {
193
        /** @var RelayBuilderInterface $builder */
194
        $builder = new Remove(
195
            $companyId,
196
            $contactId,
197
            $connection ?: HubSpot::getConnection(),
198
            $cache ?: HubSpot::getCache(),
199
            $logger ?: HubSpot::getLogger(),
200
            $config
201
        );
202
203
        return $builder->build();
204
    }
205
}
206