Code Duplication    Length = 8-8 lines in 2 locations

eZ/Bundle/EzPublishCoreBundle/Features/Context/UserContext.php 2 locations

@@ 199-206 (lines=8) @@
196
            // Found matching Group(s)
197
            if (!empty($parentSearchHits)) {
198
                $firstGroupId = $parentSearchHits[0]->valueObject->contentInfo->id;
199
                foreach ($parentSearchHits as $userGroupHit) {
200
                    $groupId = $userGroupHit->valueObject->contentInfo->id;
201
                    // Search for user in this group
202
                    $user = $this->searchUserByLogin($username, $groupId);
203
                    if ($user) {
204
                        return $user;
205
                    }
206
                }
207
208
                // create user inside existing parent Group, use first group found
209
                $parentGroup = $this->userService->loadUserGroup($firstGroupId);
@@ 243-250 (lines=8) @@
240
            // find matching Parent Group name
241
            $parentSearchHits = $this->searchUserGroups($parentGroupName, self::USERGROUP_ROOT_LOCATION);
242
            if (!empty($parentSearchHits)) {
243
                foreach ($parentSearchHits as $parentGroupFound) {
244
                    $groupId = $parentGroupFound->valueObject->contentInfo->id;
245
                    //Search for already existing matching Child user
246
                    $user = $this->searchUserByLogin($username, $groupId);
247
                    if ($user) {
248
                        break;
249
                    }
250
                }
251
            }
252
        } else {
253
            try {