Code Duplication    Length = 4-4 lines in 4 locations

src/Validator/Constraints/ClientDataConstraintValidator.php 1 location

@@ 42-45 (lines=4) @@
39
40
        $decoded = base64_decode(strtr($value, '-_', '+/'), self::STRICT);
41
42
        if ($decoded === false) {
43
            $this->context->addViolation($constraint->message, ['%reason%' => 'Not base64 decodable'], $value);
44
            return;
45
        }
46
47
        $clientData = json_decode($decoded);
48
        $jsonLastError = json_last_error();

src/Validator/Constraints/RegistrationDataConstraintValidator.php 1 location

@@ 48-51 (lines=4) @@
45
46
        $decoded = base64_decode(strtr($value, '-_', '+/'), self::STRICT);
47
48
        if ($decoded === false) {
49
            $this->context->addViolation($constraint->message, ['%reason%' => 'Not base64 decodable'], $value);
50
            return;
51
        }
52
53
        // Unpack into an array of unsigned characters (8-bits each, ie. bytes).
54
        $bytes = array_values(unpack('C*', $decoded));

src/Validator/Constraints/SignatureDataConstraintValidator.php 2 locations

@@ 42-45 (lines=4) @@
39
40
        $decoded = base64_decode(strtr($value, '-_', '+/'), self::STRICT);
41
42
        if ($decoded === false) {
43
            $this->context->addViolation($constraint->message, ['%reason%' => 'Not base64 decodable'], $value);
44
            return;
45
        }
46
47
        // See yubico/u2flib-server/src/u2flib_server/U2F.php:290
48
        if (strlen($decoded) < 6) {
@@ 48-51 (lines=4) @@
45
        }
46
47
        // See yubico/u2flib-server/src/u2flib_server/U2F.php:290
48
        if (strlen($decoded) < 6) {
49
            $this->context->addViolation($constraint->message, ['%reason%' => 'Too short'], $value);
50
            return;
51
        }
52
    }
53
}
54