Code Duplication    Length = 8-12 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 6120-6131 (lines=12) @@
6117
            $buf .= $cc1 . $cc2;
6118
          }
6119
6120
        } elseif ($c1 >= "\xe0" & $c1 <= "\xef") { // looks like 3 bytes UTF8
6121
6122
          if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf") { // yeah, almost sure it's UTF8 already
6123
            $buf .= $c1 . $c2 . $c3;
6124
            $i += 2;
6125
          } else { // not valid UTF8 - convert it
6126
            $cc1 = (chr(ord($c1) / 64) | "\xc0");
6127
            $cc2 = ($c1 & "\x3f") | "\x80";
6128
            $buf .= $cc1 . $cc2;
6129
          }
6130
6131
        } elseif ($c1 >= "\xf0" & $c1 <= "\xf7") { // looks like 4 bytes UTF8
6132
6133
          if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf" && $c4 >= "\x80" && $c4 <= "\xbf") { // yeah, almost sure it's UTF8 already
6134
            $buf .= $c1 . $c2 . $c3 . $c4;
@@ 6133-6140 (lines=8) @@
6130
6131
        } elseif ($c1 >= "\xf0" & $c1 <= "\xf7") { // looks like 4 bytes UTF8
6132
6133
          if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf" && $c4 >= "\x80" && $c4 <= "\xbf") { // yeah, almost sure it's UTF8 already
6134
            $buf .= $c1 . $c2 . $c3 . $c4;
6135
            $i += 3;
6136
          } else { // not valid UTF8 - convert it
6137
            $cc1 = (chr(ord($c1) / 64) | "\xc0");
6138
            $cc2 = ($c1 & "\x3f") | "\x80";
6139
            $buf .= $cc1 . $cc2;
6140
          }
6141
6142
        } else { // doesn't look like UTF8, but should be converted
6143
          $cc1 = (chr(ord($c1) / 64) | "\xc0");