Code Duplication    Length = 13-13 lines in 2 locations

src/Mpociot/ApiDoc/Generators/AbstractGenerator.php 2 locations

@@ 423-435 (lines=13) @@
420
                $attributeData['type'] = 'boolean';
421
                $attributeData['value'] = true;
422
                break;
423
            case 'after':
424
                $attributeData['type'] = 'date';
425
                $format = isset($attributeData['format']) ? $attributeData['format'] : DATE_RFC850;
426
427
                if (strtotime($parameters[0]) === false) {
428
                    // the `after` date refers to another parameter in the request
429
                    $paramName = $parameters[0];
430
                    $attributeData['description'][] = Description::parse($rule)->with($paramName)->getDescription();
431
                    $attributeData['value'] = date($format, strtotime('+1 day', strtotime($routeData['parameters'][$paramName]['value'])));
432
                } else {
433
                    $attributeData['description'][] = Description::parse($rule)->with(date($format, strtotime($parameters[0])))->getDescription();
434
                    $attributeData['value'] = date($format, strtotime('+1 day', strtotime($parameters[0])));
435
                }
436
                break;
437
            case 'alpha':
438
                $attributeData['description'][] = Description::parse($rule)->getDescription();
@@ 474-486 (lines=13) @@
471
                $attributeData['description'][] = Description::parse($rule)->with($parameters)->getDescription();
472
                $attributeData['value'] = $faker->numberBetween($parameters[0], $parameters[1]);
473
                break;
474
            case 'before':
475
                $attributeData['type'] = 'date';
476
                $format = isset($attributeData['format']) ? $attributeData['format'] : DATE_RFC850;
477
478
                if (strtotime($parameters[0]) === false) {
479
                    // the `before` date refers to another parameter in the request
480
                    $paramName = $parameters[0];
481
                    $attributeData['description'][] = Description::parse($rule)->with($paramName)->getDescription();
482
                    $attributeData['value'] = date($format, strtotime('-1 day', strtotime($routeData['parameters'][$paramName]['value'])));
483
                } else {
484
                    $attributeData['description'][] = Description::parse($rule)->with(date($format, strtotime($parameters[0])))->getDescription();
485
                    $attributeData['value'] = date($format, strtotime('-1 day', strtotime($parameters[0])));
486
                }
487
                break;
488
            case 'date_format':
489
                $attributeData['type'] = 'date';