Code Duplication    Length = 20-22 lines in 2 locations

src/Service/AuthenticationVerificationResult.php 1 location

@@ 105-124 (lines=20) @@
102
     * @param int $errorCode
103
     * @return self
104
     */
105
    public static function deviceReportedError($errorCode)
106
    {
107
        $validErrorCodes = [
108
            SignResponse::ERROR_CODE_OK,
109
            SignResponse::ERROR_CODE_OTHER_ERROR,
110
            SignResponse::ERROR_CODE_BAD_REQUEST,
111
            SignResponse::ERROR_CODE_CONFIGURATION_UNSUPPORTED,
112
            SignResponse::ERROR_CODE_DEVICE_INELIGIBLE,
113
            SignResponse::ERROR_CODE_TIMEOUT,
114
        ];
115
116
        if (!in_array($errorCode, $validErrorCodes, true)) {
117
            throw new InvalidArgumentException('Device error code is not one of the known error codes');
118
        }
119
120
        $result = new self(self::STATUS_DEVICE_ERROR);
121
        $result->deviceErrorCode = $errorCode;
122
123
        return $result;
124
    }
125
126
    /**
127
     * @return self

src/Service/RegistrationVerificationResult.php 1 location

@@ 100-121 (lines=22) @@
97
     * @param int $errorCode
98
     * @return RegistrationVerificationResult
99
     */
100
    public static function deviceReportedError($errorCode)
101
    {
102
        $validErrorCodes = [
103
            RegisterResponse::ERROR_CODE_OK,
104
            RegisterResponse::ERROR_CODE_OTHER_ERROR,
105
            RegisterResponse::ERROR_CODE_BAD_REQUEST,
106
            RegisterResponse::ERROR_CODE_CONFIGURATION_UNSUPPORTED,
107
            RegisterResponse::ERROR_CODE_DEVICE_INELIGIBLE,
108
            RegisterResponse::ERROR_CODE_TIMEOUT,
109
        ];
110
111
        if (!in_array($errorCode, $validErrorCodes)) {
112
            throw new InvalidArgumentException(
113
                sprintf('Device error code (%s) is not one of the known error codes', $errorCode)
114
            );
115
        }
116
117
        $result = new self(self::STATUS_DEVICE_ERROR);
118
        $result->deviceErrorCode = $errorCode;
119
120
        return $result;
121
    }
122
123
    /**
124
     * @return RegistrationVerificationResult