Code Duplication    Length = 14-14 lines in 2 locations

src/Drivers/MailchimpDriver.php 2 locations

@@ 39-52 (lines=14) @@
36
     * @throws ApiError
37
     * @throws InvalidNewsletterList
38
     */
39
    public function subscribe(string $email, array $options = [], string $listName = '')
40
    {
41
        $list = $this->lists->findByName($listName);
42
43
        $options = $this->getSubscriptionOptions($email, $options);
44
45
        $response = $this->client->post("lists/{$list->getId()}/members", $options);
46
47
        if (! $this->client->success()) {
48
            throw ApiError::responseError($this->client->getLastError(), 'mailchimp');
49
        }
50
51
        return $response;
52
    }
53
54
55
    /**
@@ 63-76 (lines=14) @@
60
     * @throws ApiError
61
     * @throws InvalidNewsletterList
62
     */
63
    public function subscribeOrUpdate(string $email, array $options = [], string $listName = '')
64
    {
65
        $list = $this->lists->findByName($listName);
66
67
        $options = $this->getSubscriptionOptions($email, $options);
68
69
        $response = $this->client->put("lists/{$list->getId()}/members/{$this->getSubscriberHash($email)}", $options);
70
71
        if (! $this->client->success()) {
72
            throw ApiError::responseError($this->client->getLastError(), 'mailchimp');
73
        }
74
75
        return $response;
76
    }
77
78
    public function addMember(string $email, array $options = [], string $listName = '')
79
    {