Code Duplication    Length = 14-14 lines in 2 locations

src/Actions/ManagesContacts.php 2 locations

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