Code Duplication    Length = 19-19 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 1843-1861 (lines=19) @@
1840
   *
1841
   * @return string
1842
   */
1843
  public static function fix_simple_utf8($str)
1844
  {
1845
    // init
1846
    $str = (string)$str;
1847
1848
    if (!isset($str[0])) {
1849
      return '';
1850
    }
1851
1852
    static $BROKEN_UTF8_TO_UTF8_KEYS_CACHE = null;
1853
    static $BROKEN_UTF8_TO_UTF8_VALUES_CACHE = null;
1854
1855
    if ($BROKEN_UTF8_TO_UTF8_KEYS_CACHE === null) {
1856
      $BROKEN_UTF8_TO_UTF8_KEYS_CACHE = array_keys(self::$BROKEN_UTF8_FIX);
1857
      $BROKEN_UTF8_TO_UTF8_VALUES_CACHE = array_values(self::$BROKEN_UTF8_FIX);
1858
    }
1859
1860
    return str_replace($BROKEN_UTF8_TO_UTF8_KEYS_CACHE, $BROKEN_UTF8_TO_UTF8_VALUES_CACHE, $str);
1861
  }
1862
1863
  /**
1864
   * Fix a double (or multiple) encoded UTF8 string.
@@ 3493-3511 (lines=19) @@
3490
   *
3491
   * @return string
3492
   */
3493
  public static function normalize_msword($str)
3494
  {
3495
    // init
3496
    $str = (string)$str;
3497
3498
    if (!isset($str[0])) {
3499
      return '';
3500
    }
3501
3502
    static $UTF8_MSWORD_KEYS_CACHE = null;
3503
    static $UTF8_MSWORD_VALUES_CACHE = null;
3504
3505
    if ($UTF8_MSWORD_KEYS_CACHE === null) {
3506
      $UTF8_MSWORD_KEYS_CACHE = array_keys(self::$UTF8_MSWORD);
3507
      $UTF8_MSWORD_VALUES_CACHE = array_values(self::$UTF8_MSWORD);
3508
    }
3509
3510
    return str_replace($UTF8_MSWORD_KEYS_CACHE, $UTF8_MSWORD_VALUES_CACHE, $str);
3511
  }
3512
3513
  /**
3514
   * Normalize the whitespace.