Code Duplication    Length = 7-10 lines in 3 locations

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

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

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

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