Code Duplication    Length = 12-14 lines in 2 locations

code/extensions/LDAPMemberExtension.php 2 locations

@@ 178-191 (lines=14) @@
175
     * Update the local data with LDAP, and ensure local membership is also set in
176
     * LDAP too. This writes into LDAP, provided that feature is enabled.
177
     */
178
    public function onAfterWrite()
179
    {
180
        $service = Injector::inst()->get('LDAPService');
181
        if (!$service->enabled()) {
182
            return;
183
        }
184
        if (!$this->owner->config()->update_ldap_from_local) {
185
            return;
186
        }
187
        if ($this->owner->GUID) {
188
            $service->updateLDAPFromMember($this->owner);
189
            $service->updateLDAPGroupsForMember($this->owner);
190
        }
191
    }
192
193
    public function onAfterDelete() {
194
        $service = Injector::inst()->get('LDAPService');
@@ 193-204 (lines=12) @@
190
        }
191
    }
192
193
    public function onAfterDelete() {
194
        $service = Injector::inst()->get('LDAPService');
195
        if (!$service->enabled()) {
196
            return;
197
        }
198
        if (!$this->owner->config()->delete_users_in_ldap) {
199
            return;
200
        }
201
        if ($this->owner->GUID) {
202
            $service->deleteLDAPMember($this->owner);
203
        }
204
    }
205
206
    /**
207
     * Triggered by {@link Member::logIn()} when successfully logged in,