Code Duplication    Length = 19-19 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 1815-1833 (lines=19) @@
1812
   *
1813
   * @return string
1814
   */
1815
  public static function fix_simple_utf8($str)
1816
  {
1817
    // init
1818
    $str = (string)$str;
1819
1820
    if (!isset($str[0])) {
1821
      return '';
1822
    }
1823
1824
    static $BROKEN_UTF8_TO_UTF8_KEYS_CACHE = null;
1825
    static $BROKEN_UTF8_TO_UTF8_VALUES_CACHE = null;
1826
1827
    if ($BROKEN_UTF8_TO_UTF8_KEYS_CACHE === null) {
1828
      $BROKEN_UTF8_TO_UTF8_KEYS_CACHE = array_keys(self::$BROKEN_UTF8_FIX);
1829
      $BROKEN_UTF8_TO_UTF8_VALUES_CACHE = array_values(self::$BROKEN_UTF8_FIX);
1830
    }
1831
1832
    return str_replace($BROKEN_UTF8_TO_UTF8_KEYS_CACHE, $BROKEN_UTF8_TO_UTF8_VALUES_CACHE, $str);
1833
  }
1834
1835
  /**
1836
   * Fix a double (or multiple) encoded UTF8 string.
@@ 3491-3509 (lines=19) @@
3488
   *
3489
   * @return string
3490
   */
3491
  public static function normalize_msword($str)
3492
  {
3493
    // init
3494
    $str = (string)$str;
3495
3496
    if (!isset($str[0])) {
3497
      return '';
3498
    }
3499
3500
    static $UTF8_MSWORD_KEYS_CACHE = null;
3501
    static $UTF8_MSWORD_VALUES_CACHE = null;
3502
3503
    if ($UTF8_MSWORD_KEYS_CACHE === null) {
3504
      $UTF8_MSWORD_KEYS_CACHE = array_keys(self::$UTF8_MSWORD);
3505
      $UTF8_MSWORD_VALUES_CACHE = array_values(self::$UTF8_MSWORD);
3506
    }
3507
3508
    return str_replace($UTF8_MSWORD_KEYS_CACHE, $UTF8_MSWORD_VALUES_CACHE, $str);
3509
  }
3510
3511
  /**
3512
   * Normalize the whitespace.