Total Complexity | 5 |
Total Lines | 68 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
10 | class Lists extends MailChimp implements ListsInterface |
||
11 | { |
||
12 | /** |
||
13 | * @var LoggerInterface |
||
14 | */ |
||
15 | private $logger; |
||
16 | |||
17 | /** |
||
18 | * @param $api_key |
||
19 | * @param LoggerInterface $logger |
||
20 | * |
||
21 | * @throws \Exception |
||
22 | */ |
||
23 | public function __construct( |
||
24 | $api_key, |
||
25 | LoggerInterface $logger |
||
26 | ) { |
||
27 | parent::__construct($api_key); |
||
28 | |||
29 | $this->logger = $logger; |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * {@inheritdoc} |
||
34 | */ |
||
35 | public function addMember(string $listId, array $data) |
||
36 | { |
||
37 | $response = $this->post('lists/' . $listId . '/members', $data); |
||
38 | |||
39 | $this->logger->info('add_member: '.json_encode($response)); |
||
40 | |||
41 | return $response; |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * {@inheritdoc} |
||
46 | */ |
||
47 | public function getMember(string $listId, string $hash) |
||
48 | { |
||
49 | $response = $this->get('lists/' . $listId . '/members/' . $hash); |
||
50 | |||
51 | $this->logger->info('get_member: '.json_encode($response)); |
||
52 | |||
53 | return $response; |
||
54 | } |
||
55 | |||
56 | /** |
||
57 | * {@inheritdoc} |
||
58 | */ |
||
59 | public function updateMember(string $listId, string $hash, array $data) |
||
60 | { |
||
61 | $response = $this->patch('lists/' . $listId . '/members/' . $hash, $data); |
||
62 | |||
63 | $this->logger->info('update_member: '.json_encode($response)); |
||
64 | |||
65 | return $response; |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * {@inheritdoc} |
||
70 | */ |
||
71 | public function removeMember(string $listId, string $hash) |
||
78 | } |
||
79 | } |
||
80 |