IpsGateway::deleteIpAddress()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 1
nc 1
nop 2
crap 1
1
<?php
2
/*
3
 * This file is part of the PayBreak/paybreak-sdk-php package.
4
 *
5
 * (c) PayBreak <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace PayBreak\Sdk\Gateways;
11
12
use PayBreak\Sdk\SdkException;
13
use PayBreak\Sdk\Entities\IpsEntity;
14
15
/**
16
 * Class IpsGateway
17
 *
18
 * @author EB
19
 * @package Paybreak\Sdk\Gateways
20
 */
21
class IpsGateway extends AbstractGateway
22
{
23
    /**
24
     * @author EB
25
     * @param string $token
26
     * @return IpsEntity[]
27
     * @throws SdkException
28
     */
29 1
    public function listIpAddresses($token)
30
    {
31 1
        $response = $this->fetchDocument('/v4/ip-addresses', $token, 'ips');
32 1
        $rtn = [];
33
34 1
        foreach ($response as $ip) {
35 1
            $rtn[] = IpsEntity::make($ip);
36 1
        }
37
38 1
        return $rtn;
39
    }
40
41
    /**
42
     * @author EB
43
     * @param string $token
44
     * @param $ip
45
     * @return array
46
     * @throws SdkException
47
     */
48 1
    public function storeIpAddress($token, $ip)
49
    {
50 1
        return $this->postDocument('/v4/ip-addresses', ['ip' => $ip], $token, 'ips');
51
    }
52
53
    /**
54
     * @author EB
55
     * @param string $token
56
     * @param int $id
57
     * @return array
58
     */
59 1
    public function deleteIpAddress($token, $id)
60
    {
61 1
        return $this->deleteDocument('/v4/ip-addresses/' . $id, $token, 'ips');
62
    }
63
}
64