Code Duplication    Length = 11-14 lines in 2 locations

src/ApiDriver.php 2 locations

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