Code Duplication    Length = 7-12 lines in 2 locations

Builder.php 2 locations

@@ 342-348 (lines=7) @@
339
                }
340
                if ('list' === $parameter['type']) {
341
                    $children = $value ?: [];
342
                    foreach ($children as $idx => $child) {
343
                        if (!is_array($child)) {
344
                            throw new ValidatorException($tmpPath, 'Expected "list", but got "map"');
345
                        }
346
347
                        $bodyResult[$parameter['locationName']][] = $this->createData($validator, $child, $parameter, $tmpPath, $action, $result);
348
                    }
349
                } elseif ('map' === $parameter['type']) {
350
                    if (is_null($value)) {
351
                        continue;
@@ 360-371 (lines=12) @@
357
                        }
358
                    }
359
360
                    foreach ($children as $parameterName => $child) {
361
                        if (is_array($child)) {
362
                            $bodyResult[$parameter['locationName']][$parameterName] = $this->createData(
363
                                $validator,
364
                                $child,
365
                                $parameter,
366
                                $tmpPath,
367
                                $action,
368
                                $result
369
                            );
370
                        }
371
                    }
372
                    $bodyResult[$parameter['locationName']] = $this->createData(
373
                        $validator,
374
                        $children,