Code Duplication    Length = 10-14 lines in 2 locations

src/Newsletter.php 2 locations

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