Code Duplication    Length = 19-19 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 1854-1872 (lines=19) @@
1851
   *
1852
   * @return string
1853
   */
1854
  public static function fix_simple_utf8($str)
1855
  {
1856
    // init
1857
    $str = (string)$str;
1858
1859
    if (!isset($str[0])) {
1860
      return '';
1861
    }
1862
1863
    static $BROKEN_UTF8_TO_UTF8_KEYS_CACHE = null;
1864
    static $BROKEN_UTF8_TO_UTF8_VALUES_CACHE = null;
1865
1866
    if ($BROKEN_UTF8_TO_UTF8_KEYS_CACHE === null) {
1867
      $BROKEN_UTF8_TO_UTF8_KEYS_CACHE = array_keys(self::$BROKEN_UTF8_FIX);
1868
      $BROKEN_UTF8_TO_UTF8_VALUES_CACHE = array_values(self::$BROKEN_UTF8_FIX);
1869
    }
1870
1871
    return str_replace($BROKEN_UTF8_TO_UTF8_KEYS_CACHE, $BROKEN_UTF8_TO_UTF8_VALUES_CACHE, $str);
1872
  }
1873
1874
  /**
1875
   * Fix a double (or multiple) encoded UTF8 string.
@@ 3679-3697 (lines=19) @@
3676
   *
3677
   * @return string
3678
   */
3679
  public static function normalize_msword($str)
3680
  {
3681
    $str = (string)$str;
3682
3683
    if (!isset($str[0])) {
3684
      return '';
3685
    }
3686
3687
    static $UTF8_MSWORD_KEYS_CACHE = null;
3688
    static $UTF8_MSWORD_VALUES_CACHE = null;
3689
3690
    if ($UTF8_MSWORD_KEYS_CACHE === null) {
3691
      $UTF8_MSWORD_KEYS_CACHE = array_keys(self::$UTF8_MSWORD);
3692
      $UTF8_MSWORD_VALUES_CACHE = array_values(self::$UTF8_MSWORD);
3693
    }
3694
3695
    return str_replace($UTF8_MSWORD_KEYS_CACHE, $UTF8_MSWORD_VALUES_CACHE, $str);
3696
  }
3697
3698
  /**
3699
   * Normalize the whitespace.
3700
   *