Code Duplication    Length = 20-20 lines in 2 locations

src/Description/Builder/OpenApiBuilder.php 1 location

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

src/Description/Builder/RamlBuilder.php 1 location

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