Code Duplication    Length = 20-20 lines in 2 locations

src/Description/Builder/OpenApiBuilder.php 1 location

@@ 230-249 (lines=20) @@
227
     *
228
     * @return Schema
229
     */
230
    protected function createParameterSchema(\stdClass $definition): Schema
231
    {
232
        // Remove non-JSON-Schema properties
233
        $schemaDefinition     = clone $definition;
234
        $swaggerPropertyNames = [
235
            'name',
236
            'in',
237
            'description',
238
            'required',
239
            'allowEmptyValue',
240
            'collectionFormat',
241
        ];
242
        foreach ($swaggerPropertyNames as $propertyName) {
243
            if (property_exists($schemaDefinition, $propertyName)) {
244
                unset($schemaDefinition->$propertyName);
245
            }
246
        }
247
248
        return $this->schemaFactory->create($schemaDefinition);
249
    }
250
251
    /**
252
     * @param \stdClass $definition

src/Description/Builder/RamlBuilder.php 1 location

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