Code Duplication    Length = 10-10 lines in 2 locations

src/Newsletter.php 2 locations

@@ 120-129 (lines=10) @@
117
     *
118
     * @throws \Spatie\Newsletter\Exceptions\InvalidNewsletterList
119
     */
120
    public function unsubscribe($email, $listName = '')
121
    {
122
        $list = $this->lists->findByName($listName);
123
124
        $response = $this->mailChimp->patch("lists/{$list->getId()}/members/{$this->getSubscriberHash($email)}", [
125
            'status' => 'unsubscribed',
126
        ]);
127
128
        return $response;
129
    }
130
    
131
    /**
132
     * Update the email address of an existing list member
@@ 142-151 (lines=10) @@
139
     *
140
     * @throws \Spatie\Newsletter\Exceptions\InvalidNewsletterList
141
     */
142
    public function updateEmailAddress($currentEmailAddress, $newEmailAddress, $listName = '')
143
    {
144
        $list = $this->lists->findByName($listName);
145
        
146
        $response = $this->mailChimp->patch("lists/{$list->getId()}/members/{$this->getSubscriberHash($currentEmailAddress)}", [
147
            'email_address' => $newEmailAddress
148
        ]);
149
        
150
        return $response;
151
    }
152
153
    /**
154
     * @param $email