Code Duplication    Length = 14-14 lines in 2 locations

src/Actions/ManagesContacts.php 2 locations

@@ 151-164 (lines=14) @@
148
     * @param \TestMonitor\ActiveCampaign\Resources\Contact $contact
149
     * @param \TestMonitor\ActiveCampaign\Resources\Automation $automation
150
     */
151
    public function removeAutomationFromContact(Contact $contact, Automation $automation)
152
    {
153
        $contactAutomations = $this->contactAutomations($contact);
154
155
        $contactAutomation = current(array_filter($contactAutomations, function ($contactAutomation) use ($automation) {
156
            return $contactAutomation->automation == $automation->id;
157
        }));
158
159
        if (empty($contactAutomation)) {
160
            return;
161
        }
162
163
        $this->delete("contactAutomations/{$contactAutomation->id}");
164
    }
165
166
    /**
167
     * Removing all automations from a contact.
@@ 186-199 (lines=14) @@
183
     * @param \TestMonitor\ActiveCampaign\Resources\Contact $contact
184
     * @param \TestMonitor\ActiveCampaign\Resources\Tag $tag
185
     */
186
    public function removeTagFromContact(Contact $contact, Tag $tag)
187
    {
188
        $contactTags = $this->contactTags($contact);
189
190
        $contactTag = current(array_filter($contactTags, function ($contactTag) use ($tag) {
191
            return $contactTag->tag == $tag->id;
192
        }));
193
194
        if (empty($contactTag)) {
195
            return;
196
        }
197
198
        $this->delete("contactTags/{$contactTag->id}");
199
    }
200
}
201