Code Duplication    Length = 20-20 lines in 2 locations

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

src/Description/Builder/OpenApiBuilder.php 1 location

@@ 249-268 (lines=20) @@
246
     *
247
     * @return Schema
248
     */
249
    protected function createParameterSchema(\stdClass $definition): Schema
250
    {
251
        // Remove non-JSON-Schema properties
252
        $schemaDefinition     = clone $definition;
253
        $swaggerPropertyNames = [
254
            'name',
255
            'in',
256
            'description',
257
            'required',
258
            'allowEmptyValue',
259
            'collectionFormat',
260
        ];
261
        foreach ($swaggerPropertyNames as $propertyName) {
262
            if (property_exists($schemaDefinition, $propertyName)) {
263
                unset($schemaDefinition->$propertyName);
264
            }
265
        }
266
267
        return $this->schemaFactory->create($schemaDefinition);
268
    }
269
270
    /**
271
     * @param \stdClass $definition