Code Duplication    Length = 8-8 lines in 2 locations

module/Rest/src/Middleware/CheckAuthenticationMiddleware.php 2 locations

@@ 100-107 (lines=8) @@
97
        // Get token making sure the an authorization type is provided
98
        $authToken = $request->getHeaderLine(self::AUTHORIZATION_HEADER);
99
        $authTokenParts = explode(' ', $authToken);
100
        if (count($authTokenParts) === 1) {
101
            return new JsonResponse([
102
                'error' => RestUtils::INVALID_AUTHORIZATION_ERROR,
103
                'message' => sprintf($this->translator->translate(
104
                    'You need to provide the Bearer type in the %s header.'
105
                ), self::AUTHORIZATION_HEADER),
106
            ], 401);
107
        }
108
109
        // Make sure the authorization type is Bearer
110
        list($authType, $jwt) = $authTokenParts;
@@ 111-118 (lines=8) @@
108
109
        // Make sure the authorization type is Bearer
110
        list($authType, $jwt) = $authTokenParts;
111
        if (strtolower($authType) !== 'bearer') {
112
            return new JsonResponse([
113
                'error' => RestUtils::INVALID_AUTHORIZATION_ERROR,
114
                'message' => sprintf($this->translator->translate(
115
                    'Provided authorization type %s is not supported. Use Bearer instead.'
116
                ), $authType),
117
            ], 401);
118
        }
119
120
        try {
121
            ErrorHandler::start();