Code Duplication    Length = 10-14 lines in 2 locations

src/Newsletter.php 2 locations

@@ 144-157 (lines=14) @@
141
        return true;
142
    }
143
144
    public function unsubscribe(string $email, string $listName = '')
145
    {
146
        $list = $this->lists->findByName($listName);
147
148
        $response = $this->mailChimp->patch("lists/{$list->getId()}/members/{$this->getSubscriberHash($email)}", [
149
            'status' => 'unsubscribed',
150
        ]);
151
152
        if (! $this->lastActionSucceeded()) {
153
            return false;
154
        }
155
156
        return $response;
157
    }
158
159
    public function updateEmailAddress(string $currentEmailAddress, string $newEmailAddress, string $listName = '')
160
    {
@@ 159-168 (lines=10) @@
156
        return $response;
157
    }
158
159
    public function updateEmailAddress(string $currentEmailAddress, string $newEmailAddress, string $listName = '')
160
    {
161
        $list = $this->lists->findByName($listName);
162
163
        $response = $this->mailChimp->patch("lists/{$list->getId()}/members/{$this->getSubscriberHash($currentEmailAddress)}", [
164
            'email_address' => $newEmailAddress,
165
        ]);
166
167
        return $response;
168
    }
169
170
    public function delete(string $email, string $listName = '')
171
    {