Code Duplication    Length = 7-10 lines in 3 locations

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

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

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

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

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

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