Code Duplication    Length = 10-14 lines in 2 locations

src/Newsletter.php 2 locations

@@ 127-140 (lines=14) @@
124
        return true;
125
    }
126
127
    public function unsubscribe(string $email, string $listName = '')
128
    {
129
        $list = $this->lists->findByName($listName);
130
131
        $response = $this->mailChimp->patch("lists/{$list->getId()}/members/{$this->getSubscriberHash($email)}", [
132
            'status' => 'unsubscribed',
133
        ]);
134
135
        if (! $this->lastActionSucceeded()) {
136
            return false;
137
        }
138
139
        return $response;
140
    }
141
142
    public function updateEmailAddress(string $currentEmailAddress, string $newEmailAddress, string $listName = '')
143
    {
@@ 142-151 (lines=10) @@
139
        return $response;
140
    }
141
142
    public function updateEmailAddress(string $currentEmailAddress, string $newEmailAddress, string $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
    public function delete(string $email, string $listName = '')
154
    {