Code Duplication    Length = 14-14 lines in 2 locations

src/Actions/ManagesContacts.php 2 locations

@@ 142-155 (lines=14) @@
139
     * @param \TestMonitor\ActiveCampaign\Resources\Contact $contact
140
     * @param \TestMonitor\ActiveCampaign\Resources\Automation $automation
141
     */
142
    public function removeAutomationFromContact(Contact $contact, Automation $automation)
143
    {
144
        $contactAutomations = $this->contactAutomations($contact);
145
146
        $contactAutomation = current(array_filter($contactAutomations, function ($contactAutomation) use ($automation) {
147
            return $contactAutomation->automation == $automation->id;
148
        }));
149
150
        if (empty($contactAutomation)) {
151
            return;
152
        }
153
154
        $this->delete("contactAutomations/{$contactAutomation->id}");
155
    }
156
157
    /**
158
     * Removing all automations from a contact.
@@ 177-190 (lines=14) @@
174
     * @param \TestMonitor\ActiveCampaign\Resources\Contact $contact
175
     * @param \TestMonitor\ActiveCampaign\Resources\Tag $tag
176
     */
177
    public function removeTagFromContact(Contact $contact, Tag $tag)
178
    {
179
        $contactTags = $this->contactTags($contact);
180
181
        $contactTag = current(array_filter($contactTags, function ($contactTag) use ($tag) {
182
            return $contactTag->tag == $tag->id;
183
        }));
184
185
        if (empty($contactTag)) {
186
            return;
187
        }
188
189
        $this->delete("contactTags/{$contactTag->id}");
190
    }
191
}
192