Code Duplication    Length = 14-14 lines in 2 locations

src/Actions/ManagesContacts.php 2 locations

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