Code Duplication    Length = 7-10 lines in 3 locations

eZ/Publish/Core/REST/Server/Input/Parser/RoleAssignInput.php 1 location

@@ 67-76 (lines=10) @@
64
65
        // @todo XSD says that limitation is mandatory, but roles can be assigned without limitations
66
        $limitation = null;
67
        if (array_key_exists('limitation', $data) && is_array($data['limitation'])) {
68
            if (!array_key_exists('_identifier', $data['limitation'])) {
69
                throw new Exceptions\Parser("Missing '_identifier' attribute for Limitation.");
70
            }
71
72
            $limitation = $parsingDispatcher->parse(
73
                $data['limitation'],
74
                'application/vnd.ez.api.internal.limitation.'  . $data['limitation']['_identifier']
75
            );
76
        }
77
78
        return new RoleAssignment($roleId, $limitation);
79
    }

eZ/Publish/Core/REST/Server/Input/Parser/UserGroupUpdate.php 1 location

@@ 87-93 (lines=7) @@
84
            $parsedData['mainLanguageCode'] = $data['mainLanguageCode'];
85
        }
86
87
        if (array_key_exists('Section', $data) && is_array($data['Section'])) {
88
            if (!array_key_exists('_href', $data['Section'])) {
89
                throw new Exceptions\Parser("Missing '_href' attribute for Section element in UserGroupUpdate.");
90
            }
91
92
            $parsedData['sectionId'] = $this->requestParser->parseHref($data['Section']['_href'], 'sectionId');
93
        }
94
95
        if (array_key_exists('remoteId', $data)) {
96
            $parsedData['remoteId'] = $data['remoteId'];

eZ/Publish/Core/REST/Server/Input/Parser/UserUpdate.php 1 location

@@ 101-107 (lines=7) @@
98
            $parsedData['mainLanguageCode'] = $data['mainLanguageCode'];
99
        }
100
101
        if (array_key_exists('Section', $data) && is_array($data['Section'])) {
102
            if (!array_key_exists('_href', $data['Section'])) {
103
                throw new Exceptions\Parser("Missing '_href' attribute for Section element in UserUpdate.");
104
            }
105
106
            $parsedData['sectionId'] = $this->requestParser->parseHref($data['Section']['_href'], 'sectionId');
107
        }
108
109
        if (array_key_exists('remoteId', $data)) {
110
            $parsedData['remoteId'] = $data['remoteId'];