Code Duplication    Length = 7-7 lines in 4 locations

eZ/Publish/Core/REST/Server/Input/Parser/ContentUpdate.php 2 locations

@@ 41-47 (lines=7) @@
38
    {
39
        $parsedData = array();
40
41
        if (array_key_exists('Section', $data) && is_array($data['Section']) && isset($data['Section']['_href'])) {
42
            try {
43
                $parsedData['sectionId'] = $this->requestParser->parseHref($data['Section']['_href'], 'sectionId');
44
            } catch (Exceptions\InvalidArgumentException $e) {
45
                throw new Exceptions\Parser('Invalid format for <Section> reference in <ContentUpdate>.');
46
            }
47
        }
48
49
        if (array_key_exists('Owner', $data) && is_array($data['Owner']) && isset($data['Owner']['_href'])) {
50
            try {
@@ 49-55 (lines=7) @@
46
            }
47
        }
48
49
        if (array_key_exists('Owner', $data) && is_array($data['Owner']) && isset($data['Owner']['_href'])) {
50
            try {
51
                $parsedData['ownerId'] = $this->requestParser->parseHref($data['Owner']['_href'], 'userId');
52
            } catch (Exceptions\InvalidArgumentException $e) {
53
                throw new Exceptions\Parser('Invalid format for <Owner> reference in <ContentUpdate>.');
54
            }
55
        }
56
57
        if (array_key_exists('mainLanguageCode', $data)) {
58
            $parsedData['mainLanguageCode'] = $data['mainLanguageCode'];

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'];