Code Duplication    Length = 19-19 lines in 2 locations

src/Http/BaseController.php 2 locations

@@ 65-83 (lines=19) @@
62
    /**
63
     * @inheritdoc
64
     */
65
    public static function index(
66
        array $routeParams,
67
        ContainerInterface $container,
68
        ServerRequestInterface $request
69
    ): ResponseInterface {
70
        // By default no filters, sorts or includes are allowed from query. You can override this method to change it.
71
        $parser = static::configureOnIndexParser(static::createQueryParser($container))
72
            ->parse($request->getQueryParams());
73
        $mapper = static::createParameterMapper($container);
74
        $api    = static::createApi($container);
75
76
        $models = $mapper->applyQueryParameters($parser, $api)->index();
77
78
        $responses = static::createResponses($container, $request, $parser->createEncodingParameters());
79
        $response  = ($models->getData()) === null ?
80
            $responses->getCodeResponse(404) : $responses->getContentResponse($models);
81
82
        return $response;
83
    }
84
85
    /**
86
     * @inheritdoc
@@ 105-123 (lines=19) @@
102
    /**
103
     * @inheritdoc
104
     */
105
    public static function read(
106
        array $routeParams,
107
        ContainerInterface $container,
108
        ServerRequestInterface $request
109
    ): ResponseInterface {
110
        // By default no filters, sorts or includes are allowed from query. You can override this method to change it.
111
        $parser = static::configureOnReadParser(static::createQueryParser($container))
112
            ->parse($request->getQueryParams());
113
        $mapper = static::createParameterMapper($container);
114
115
        $index     = $routeParams[static::ROUTE_KEY_INDEX];
116
        $modelData = $mapper->applyQueryParameters($parser, static::createApi($container))->read($index)->getData();
117
118
        $responses = static::createResponses($container, $request, $parser->createEncodingParameters());
119
        $response  = $modelData === null ?
120
            $responses->getCodeResponse(404) : $responses->getContentResponse($modelData);
121
122
        return $response;
123
    }
124
125
    /**
126
     * @inheritdoc