Code Duplication    Length = 19-19 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 1774-1792 (lines=19) @@
1771
   *
1772
   * @return string
1773
   */
1774
  public static function fix_simple_utf8($str)
1775
  {
1776
    // init
1777
    $str = (string)$str;
1778
1779
    if (!isset($str[0])) {
1780
      return '';
1781
    }
1782
1783
    static $BROKEN_UTF8_TO_UTF8_KEYS_CACHE = null;
1784
    static $BROKEN_UTF8_TO_UTF8_VALUES_CACHE = null;
1785
1786
    if ($BROKEN_UTF8_TO_UTF8_KEYS_CACHE === null) {
1787
      $BROKEN_UTF8_TO_UTF8_KEYS_CACHE = array_keys(self::$brokenUtf8ToUtf8);
1788
      $BROKEN_UTF8_TO_UTF8_VALUES_CACHE = array_values(self::$brokenUtf8ToUtf8);
1789
    }
1790
1791
    return str_replace($BROKEN_UTF8_TO_UTF8_KEYS_CACHE, $BROKEN_UTF8_TO_UTF8_VALUES_CACHE, $str);
1792
  }
1793
1794
  /**
1795
   * Fix a double (or multiple) encoded UTF8 string.
@@ 3390-3408 (lines=19) @@
3387
   *
3388
   * @return string
3389
   */
3390
  public static function normalize_msword($str)
3391
  {
3392
    // init
3393
    $str = (string)$str;
3394
3395
    if (!isset($str[0])) {
3396
      return '';
3397
    }
3398
3399
    static $UTF8_MSWORD_KEYS_CACHE = null;
3400
    static $UTF8_MSWORD_VALUES_CACHE = null;
3401
3402
    if ($UTF8_MSWORD_KEYS_CACHE === null) {
3403
      $UTF8_MSWORD_KEYS_CACHE = array_keys(self::$utf8MSWord);
3404
      $UTF8_MSWORD_VALUES_CACHE = array_values(self::$utf8MSWord);
3405
    }
3406
3407
    return str_replace($UTF8_MSWORD_KEYS_CACHE, $UTF8_MSWORD_VALUES_CACHE, $str);
3408
  }
3409
3410
  /**
3411
   * Normalize the whitespace.