Code Duplication    Length = 12-13 lines in 2 locations

src/Phossa2/Uuid/Traits/UtilityTrait.php 2 locations

@@ 72-83 (lines=12) @@
69
    /**
70
     * {@inheritDoc}
71
     */
72
    public static function encode(
73
        /*# string */ $uuid,
74
        /*# string */ $base = self::BASE56
75
    )/*# : string */ {
76
        if (static::isValid($uuid)) {
77
            return static::convertBase($uuid, self::BASE16, $base);
78
        }
79
        throw new LogicException(
80
            Message::get(Message::UUID_INVALID, $uuid),
81
            Message::UUID_INVALID
82
        );
83
    }
84
85
    /**
86
     * {@inheritDoc}
@@ 88-100 (lines=13) @@
85
    /**
86
     * {@inheritDoc}
87
     */
88
    public static function decode(
89
        /*# string */ $string,
90
        /*# string */ $base = self::BASE56
91
    )/*# : string */ {
92
        $uuid = static::convertBase($string, $base, self::BASE16);
93
        if (static::isValid($uuid)) {
94
            return $uuid;
95
        }
96
        throw new LogicException(
97
            Message::get(Message::UUID_DECODE_FAIL, $string),
98
            Message::UUID_DECODE_FAIL
99
        );
100
    }
101
102
    /**
103
     * Convert numerical string between bases