Code Duplication    Length = 7-10 lines in 3 locations

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

@@ 86-92 (lines=7) @@
83
        }
84
85
        // modificationDate
86
        if (array_key_exists('modificationDate', $data)) {
87
            try {
88
                $parsedData['modificationDate'] = new DateTime($data['modificationDate']);
89
            } catch (Exception $e) {
90
                throw new Exceptions\Parser('Invalid format for <modificationDate> in <ContentUpdate>', 0, $e);
91
            }
92
        }
93
94
        // publishDate
95
        if (array_key_exists('publishDate', $data)) {
@@ 95-101 (lines=7) @@
92
        }
93
94
        // publishDate
95
        if (array_key_exists('publishDate', $data)) {
96
            try {
97
                $parsedData['publishedDate'] = new DateTime($data['publishDate']);
98
            } catch (Exception $e) {
99
                throw new Exceptions\Parser('Invalid format for <publishDate> in <ContentUpdate>', 0, $e);
100
            }
101
        }
102
103
        return new RestContentMetadataUpdateStruct($parsedData);
104
    }

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

@@ 135-144 (lines=10) @@
132
        }
133
134
        // @todo XSD says that defaultValue is mandatory, but content type can be created without it
135
        if (array_key_exists('defaultValue', $data)) {
136
            try {
137
                $fieldDefinitionCreate->defaultValue = $this->fieldTypeParser->parseValue(
138
                    $data['fieldType'],
139
                    $data['defaultValue']
140
                );
141
            } catch (Exception $e) {
142
                throw new Exceptions\Parser("Invalid 'defaultValue' element for FieldDefinitionCreate.", 0, $e);
143
            }
144
        }
145
146
        if (array_key_exists('validatorConfiguration', $data)) {
147
            $fieldDefinitionCreate->validatorConfiguration = $this->fieldTypeParser->parseValidatorConfiguration(