Code Duplication    Length = 14-14 lines in 2 locations

src/Actions/ManagesContacts.php 2 locations

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