ContactLists   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 35
ccs 0
cts 12
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A addContacts() 0 4 1
A asyncAll() 0 4 1
A createAddContactsRequest() 0 4 1
1
<?php
2
3
/*
4
 * A php library for using the Emarsys API.
5
 *
6
 * @link      https://github.com/quitoque/emarsys-php-client
7
 * @package   emarsys-php-client
8
 * @license   MIT
9
 * @copyright Copyright (c) 2017 Quitoque <[email protected]>
10
 */
11
12
namespace Emarsys\Api;
13
14
use Http\Promise\Promise;
15
use Psr\Http\Message\ResponseInterface;
16
17
/**
18
 * Class ContactLists.
19
 *
20
 * @author Claude Khedhiri <[email protected]>
21
 */
22
class ContactLists extends AbstractApi
23
{
24
    /**
25
     * @param string $listId
26
     * @param array  $contacts
27
     *
28
     * @return ResponseInterface
29
     */
30
    public function addContacts($listId, $contacts)
31
    {
32
        return $this->sendRequest($this->createAddContactsRequest($listId, $contacts));
33
    }
34
35
    /**
36
     * @param string $listId
37
     * @param array  $contacts
38
     *
39
     * @return Promise
40
     */
41
    public function asyncAll($listId, $contacts)
42
    {
43
        return $this->sendAsyncRequest($this->createAddContactsRequest($listId, $contacts));
44
    }
45
46
    /**
47
     * @param string $listId
48
     * @param array  $contacts
49
     *
50
     * @return \Psr\Http\Message\RequestInterface
51
     */
52
    private function createAddContactsRequest($listId, $contacts)
53
    {
54
        return $this->createRequest('POST', "/contactlist/$listId/", $contacts);
55
    }
56
}
57