Code Duplication    Length = 11-11 lines in 2 locations

src/Packer.php 2 locations

@@ 124-134 (lines=11) @@
121
        return $data;
122
    }
123
124
    public function packArrayLength($length)
125
    {
126
        if ($length <= 0xf) {
127
            return \chr(0x90 | $length);
128
        }
129
        if ($length <= 0xffff) {
130
            return "\xdc".\chr($length >> 8).\chr($length);
131
        }
132
133
        return \pack('CN', 0xdd, $length);
134
    }
135
136
    public function packMap(array $map)
137
    {
@@ 148-158 (lines=11) @@
145
        return $data;
146
    }
147
148
    public function packMapLength($length)
149
    {
150
        if ($length <= 0xf) {
151
            return \chr(0x80 | $length);
152
        }
153
        if ($length <= 0xffff) {
154
            return "\xde".\chr($length >> 8).\chr($length);
155
        }
156
157
        return \pack('CN', 0xdf, $length);
158
    }
159
160
    public function packStr($str)
161
    {