Code Duplication    Length = 8-8 lines in 2 locations

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

@@ 86-93 (lines=8) @@
83
        // Get token making sure the an authorization type is provided
84
        $authToken = $request->getHeaderLine(self::AUTHORIZATION_HEADER);
85
        $authTokenParts = explode(' ', $authToken);
86
        if (count($authTokenParts) === 1) {
87
            return new JsonResponse([
88
                'error' => RestUtils::INVALID_AUTHORIZATION_ERROR,
89
                'message' => sprintf($this->translator->translate(
90
                    'You need to provide the Bearer type in the %s header.'
91
                ), self::AUTHORIZATION_HEADER),
92
            ], self::STATUS_UNAUTHORIZED);
93
        }
94
95
        // Make sure the authorization type is Bearer
96
        list($authType, $jwt) = $authTokenParts;
@@ 97-104 (lines=8) @@
94
95
        // Make sure the authorization type is Bearer
96
        list($authType, $jwt) = $authTokenParts;
97
        if (strtolower($authType) !== 'bearer') {
98
            return new JsonResponse([
99
                'error' => RestUtils::INVALID_AUTHORIZATION_ERROR,
100
                'message' => sprintf($this->translator->translate(
101
                    'Provided authorization type %s is not supported. Use Bearer instead.'
102
                ), $authType),
103
            ], self::STATUS_UNAUTHORIZED);
104
        }
105
106
        try {
107
            ErrorHandler::start();