Code Duplication    Length = 10-14 lines in 2 locations

src/Newsletter.php 2 locations

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