AccountsApi   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 33
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A list() 0 5 1
A add() 0 4 1
A delete() 0 4 1
A getLoginToken() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Incapsula\Api;
6
7
class AccountsApi extends AbstractApi
8
{
9
    /**
10
     * @var string
11
     */
12
    private $apiUri = 'https://my.incapsula.com/api/prov/v1';
13
14
    public function delete(string $subAccountId): array
15
    {
16
        return $this->client->send(sprintf('%s/subaccounts/delete', $this->apiUri), [
17
            'sub_account_id' => $subAccountId,
18
        ]);
19
    }
20
21
    public function add(string $subAccountName): array
22
    {
23
        return $this->client->send(sprintf('%s/subaccounts/add', $this->apiUri), [
24
            'sub_account_name' => $subAccountName,
25
        ]);
26
    }
27
28
    public function list(int $pageSize = 50, int $pageNum = 0): array
29
    {
30
        return $this->client->send(sprintf('%s/accounts/listSubAccounts', $this->apiUri), [
31
            'page_size' => $pageSize,
32
            'page_num' => $pageNum,
33
        ]);
34
    }
35
36
    public function getLoginToken(string $accountId): array
37
    {
38
        return $this->client->send(sprintf('%s/accounts/gettoken', $this->apiUri), [
39
            'account_id' => $accountId,
40
        ]);
41
    }
42
}
43