Code Duplication    Length = 8-12 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 6607-6618 (lines=12) @@
6604
            $buf .= $cc1 . $cc2;
6605
          }
6606
6607
        } elseif ($c1 >= "\xe0" & $c1 <= "\xef") { // looks like 3 bytes UTF8
6608
6609
          if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf") { // yeah, almost sure it's UTF8 already
6610
            $buf .= $c1 . $c2 . $c3;
6611
            $i += 2;
6612
          } else { // not valid UTF8 - convert it
6613
            $cc1 = (chr(ord($c1) / 64) | "\xc0");
6614
            $cc2 = ($c1 & "\x3f") | "\x80";
6615
            $buf .= $cc1 . $cc2;
6616
          }
6617
6618
        } elseif ($c1 >= "\xf0" & $c1 <= "\xf7") { // looks like 4 bytes UTF8
6619
6620
          if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf" && $c4 >= "\x80" && $c4 <= "\xbf") { // yeah, almost sure it's UTF8 already
6621
            $buf .= $c1 . $c2 . $c3 . $c4;
@@ 6620-6627 (lines=8) @@
6617
6618
        } elseif ($c1 >= "\xf0" & $c1 <= "\xf7") { // looks like 4 bytes UTF8
6619
6620
          if ($c2 >= "\x80" && $c2 <= "\xbf" && $c3 >= "\x80" && $c3 <= "\xbf" && $c4 >= "\x80" && $c4 <= "\xbf") { // yeah, almost sure it's UTF8 already
6621
            $buf .= $c1 . $c2 . $c3 . $c4;
6622
            $i += 3;
6623
          } else { // not valid UTF8 - convert it
6624
            $cc1 = (chr(ord($c1) / 64) | "\xc0");
6625
            $cc2 = ($c1 & "\x3f") | "\x80";
6626
            $buf .= $cc1 . $cc2;
6627
          }
6628
6629
        } else { // doesn't look like UTF8, but should be converted
6630
          $cc1 = (chr(ord($c1) / 64) | "\xc0");