Code Duplication    Length = 11-14 lines in 2 locations

src/ApiDriver.php 2 locations

@@ 113-126 (lines=14) @@
110
        return true;
111
    }
112
113
    public function unsubscribe(string $email, string $listName = '')
114
    {
115
        $list = $this->lists->findByName($listName);
116
117
        $response = $this->mailChimp->patch("lists/{$list->getId()}/members/{$this->getSubscriberHash($email)}", [
118
            'status' => 'unsubscribed',
119
        ]);
120
121
        if (! $this->lastActionSucceeded()) {
122
            return false;
123
        }
124
125
        return $response;
126
    }
127
128
    public function updateEmailAddress(string $currentEmailAddress, string $newEmailAddress, string $listName = '')
129
    {
@@ 128-138 (lines=11) @@
125
        return $response;
126
    }
127
128
    public function updateEmailAddress(string $currentEmailAddress, string $newEmailAddress, string $listName = '')
129
    {
130
        $list = $this->lists->findByName($listName);
131
132
        $response = $this->mailChimp->patch("lists/{$list->getId()}/members/{$this->getSubscriberHash($currentEmailAddress)}",
133
            [
134
                'email_address' => $newEmailAddress,
135
            ]);
136
137
        return $response;
138
    }
139
140
    public function delete(string $email, string $listName = '')
141
    {