Code Duplication    Length = 20-20 lines in 2 locations

src/Description/Builder/OpenApiBuilder.php 1 location

@@ 215-234 (lines=20) @@
212
     *
213
     * @return Schema
214
     */
215
    protected function createParameterSchema(\stdClass $definition): Schema
216
    {
217
        // Remove non-JSON-Schema properties
218
        $schemaDefinition     = clone $definition;
219
        $swaggerPropertyNames = [
220
            'name',
221
            'in',
222
            'description',
223
            'required',
224
            'allowEmptyValue',
225
            'collectionFormat'
226
        ];
227
        foreach ($swaggerPropertyNames as $propertyName) {
228
            if (property_exists($schemaDefinition, $propertyName)) {
229
                unset($schemaDefinition->$propertyName);
230
            }
231
        }
232
233
        return $this->schemaFactory->create($schemaDefinition);
234
    }
235
}
236

src/Description/Builder/RamlBuilder.php 1 location

@@ 163-182 (lines=20) @@
160
     *
161
     * @return Schema
162
     */
163
    protected function createParameterSchema(\stdClass $definition): Schema
164
    {
165
        // Remove non-JSON-Schema properties
166
        $schemaDefinition     = clone $definition;
167
        $swaggerPropertyNames = [
168
            'name',
169
            'in',
170
            'description',
171
            'required',
172
            'allowEmptyValue',
173
            'collectionFormat'
174
        ];
175
        foreach ($swaggerPropertyNames as $propertyName) {
176
            if (property_exists($schemaDefinition, $propertyName)) {
177
                unset($schemaDefinition->$propertyName);
178
            }
179
        }
180
181
        return $this->schemaFactory->create($schemaDefinition);
182
    }
183
}
184