Code Duplication    Length = 9-10 lines in 2 locations

src/Core/WechatCode/Pkcs7Encoder.php 1 location

@@ 49-57 (lines=9) @@
46
     *
47
     * @return 删除填充补位后的明文
48
     */
49
    public function decode($text)
50
    {
51
        $pad = ord(substr($text, -1));
52
        if ($pad < 1 || $pad > 32) {
53
            $pad = 0;
54
        }
55
56
        return substr($text, 0, (strlen($text) - $pad));
57
    }
58
}
59

src/Core/WechatCode/Prpcrypt.php 1 location

@@ 149-158 (lines=10) @@
146
     *
147
     * @return string
148
     */
149
    public function decode($decrypted)
150
    {
151
        $pad = ord(substr($decrypted, -1));
152
153
        if ($pad < 1 || $pad > $this->blockSize) {
154
            $pad = 0;
155
        }
156
157
        return substr($decrypted, 0, (strlen($decrypted) - $pad));
158
    }
159
160
    /**
161
     * Encode string.