Code Duplication    Length = 5-9 lines in 3 locations

Core/FieldHandler/EzRelationList.php 1 location

@@ 35-40 (lines=6) @@
32
            $ids = $fieldValue;
33
        }
34
35
        foreach ($ids as $key => $id) {
36
            // 1. resolve relations
37
            $ids[$key] = $this->referenceResolver->resolveReference($id);
38
            // 2. resolve remote ids
39
            $ids[$key] = $this->contentMatcher->matchOneByKey($ids[$key])->id;
40
        }
41
42
        return new Value($ids);
43
    }

Core/Executor/UserGroupManager.php 1 location

@@ 65-69 (lines=5) @@
62
        if (isset($step->dsl['roles'])) {
63
            $roleService = $this->repository->getRoleService();
64
            // we support both Ids and Identifiers
65
            foreach ($step->dsl['roles'] as $roleId) {
66
                $roleId = $this->referenceResolver->resolveReference($roleId);
67
                $role = $this->roleMatcher->matchOneByKey($roleId);
68
                $roleService->assignRoleToUserGroup($role, $userGroup);
69
            }
70
        }
71
72
        $this->setReferences($userGroup, $step);

Core/Executor/UserManager.php 1 location

@@ 46-54 (lines=9) @@
43
        $contentTypeService = $this->repository->getContentTypeService();
44
45
        $userGroups = array();
46
        foreach ($step->dsl['groups'] as $groupId) {
47
            $groupId = $this->referenceResolver->resolveReference($groupId);
48
            $userGroup = $this->userGroupMatcher->matchOneByKey($groupId);
49
50
            // q: in which case can we have no group? And should we throw an exception?
51
            //if ($userGroup) {
52
                $userGroups[] = $userGroup;
53
            //}
54
        }
55
56
        // FIXME: Hard coding content type to user for now
57
        $userContentType = $contentTypeService->loadContentTypeByIdentifier($this->getUserContentType($step));