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