Code Duplication    Length = 14-14 lines in 2 locations

src/Actions/ManagesContacts.php 2 locations

@@ 167-180 (lines=14) @@
164
     * @param \TestMonitor\ActiveCampaign\Resources\Contact $contact
165
     * @param \TestMonitor\ActiveCampaign\Resources\Automation $automation
166
     */
167
    public function removeAutomationFromContact(Contact $contact, Automation $automation)
168
    {
169
        $contactAutomations = $this->contactAutomations($contact);
170
171
        $contactAutomation = current(array_filter($contactAutomations, function ($contactAutomation) use ($automation) {
172
            return $contactAutomation->automation == $automation->id;
173
        }));
174
175
        if (empty($contactAutomation)) {
176
            return;
177
        }
178
179
        $this->delete("contactAutomations/{$contactAutomation->id}");
180
    }
181
182
    /**
183
     * Removing all automations from a contact.
@@ 202-215 (lines=14) @@
199
     * @param \TestMonitor\ActiveCampaign\Resources\Contact $contact
200
     * @param \TestMonitor\ActiveCampaign\Resources\Tag $tag
201
     */
202
    public function removeTagFromContact(Contact $contact, Tag $tag)
203
    {
204
        $contactTags = $this->contactTags($contact);
205
206
        $contactTag = current(array_filter($contactTags, function ($contactTag) use ($tag) {
207
            return $contactTag->tag == $tag->id;
208
        }));
209
210
        if (empty($contactTag)) {
211
            return;
212
        }
213
214
        $this->delete("contactTags/{$contactTag->id}");
215
    }
216
217
    /**
218
     * Determines the contact ID.