Code Duplication    Length = 21-21 lines in 2 locations

src/PathResolver/DashOperationPathResolver.php 1 location

@@ 25-45 (lines=21) @@
22
 *
23
 * @deprecated since version 2.1, to be removed in 3.0. Use {@see \ApiPlatform\Core\Operation\DashPathSegmentNameGenerator} instead.
24
 */
25
final class DashOperationPathResolver implements OperationPathResolverInterface
26
{
27
    public function __construct()
28
    {
29
        @trigger_error(sprintf('The use of %s is deprecated since 2.1. Please use %s instead.', __CLASS__, DashPathSegmentNameGenerator::class), E_USER_DEPRECATED);
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function resolveOperationPath(string $resourceShortName, array $operation, $operationType/*, string $operationName = null*/): string
36
    {
37
        if (func_num_args() >= 4) {
38
            $operationName = func_get_arg(3);
39
        } else {
40
            $operationName = null;
41
        }
42
43
        return (new OperationPathResolver(new DashPathSegmentNameGenerator()))->resolveOperationPath($resourceShortName, $operation, $operationType, $operationName);
44
    }
45
}
46

src/PathResolver/UnderscoreOperationPathResolver.php 1 location

@@ 25-45 (lines=21) @@
22
 *
23
 * @deprecated since version 2.1, to be removed in 3.0. Use {@see \ApiPlatform\Core\Operation\UnderscorePathSegmentNameGenerator} instead.
24
 */
25
final class UnderscoreOperationPathResolver implements OperationPathResolverInterface
26
{
27
    public function __construct()
28
    {
29
        @trigger_error(sprintf('The use of %s is deprecated since 2.1. Please use %s instead.', __CLASS__, UnderscorePathSegmentNameGenerator::class), E_USER_DEPRECATED);
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function resolveOperationPath(string $resourceShortName, array $operation, $operationType/*, string $operationName = null*/): string
36
    {
37
        if (func_num_args() >= 4) {
38
            $operationName = func_get_arg(3);
39
        } else {
40
            $operationName = null;
41
        }
42
43
        return (new OperationPathResolver(new UnderscorePathSegmentNameGenerator()))->resolveOperationPath($resourceShortName, $operation, $operationType, $operationName);
44
    }
45
}
46