Code Duplication    Length = 10-10 lines in 2 locations

src/Newsletter.php 2 locations

@@ 148-157 (lines=10) @@
145
     *
146
     * @throws \Spatie\Newsletter\Exceptions\InvalidNewsletterList
147
     */
148
    public function unsubscribe($email, $listName = '')
149
    {
150
        $list = $this->lists->findByName($listName);
151
152
        $response = $this->mailChimp->patch("lists/{$list->getId()}/members/{$this->getSubscriberHash($email)}", [
153
            'status' => 'unsubscribed',
154
        ]);
155
156
        return $response;
157
    }
158
159
    /**
160
     * Update the email address of an existing list member.
@@ 170-179 (lines=10) @@
167
     *
168
     * @throws \Spatie\Newsletter\Exceptions\InvalidNewsletterList
169
     */
170
    public function updateEmailAddress($currentEmailAddress, $newEmailAddress, $listName = '')
171
    {
172
        $list = $this->lists->findByName($listName);
173
174
        $response = $this->mailChimp->patch("lists/{$list->getId()}/members/{$this->getSubscriberHash($currentEmailAddress)}", [
175
            'email_address' => $newEmailAddress,
176
        ]);
177
178
        return $response;
179
    }
180
181
    /**
182
     * @param $email