Code Duplication    Length = 19-19 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 1845-1863 (lines=19) @@
1842
   *
1843
   * @return string
1844
   */
1845
  public static function fix_simple_utf8($str)
1846
  {
1847
    // init
1848
    $str = (string)$str;
1849
1850
    if (!isset($str[0])) {
1851
      return '';
1852
    }
1853
1854
    static $BROKEN_UTF8_TO_UTF8_KEYS_CACHE = null;
1855
    static $BROKEN_UTF8_TO_UTF8_VALUES_CACHE = null;
1856
1857
    if ($BROKEN_UTF8_TO_UTF8_KEYS_CACHE === null) {
1858
      $BROKEN_UTF8_TO_UTF8_KEYS_CACHE = array_keys(self::$BROKEN_UTF8_FIX);
1859
      $BROKEN_UTF8_TO_UTF8_VALUES_CACHE = array_values(self::$BROKEN_UTF8_FIX);
1860
    }
1861
1862
    return str_replace($BROKEN_UTF8_TO_UTF8_KEYS_CACHE, $BROKEN_UTF8_TO_UTF8_VALUES_CACHE, $str);
1863
  }
1864
1865
  /**
1866
   * Fix a double (or multiple) encoded UTF8 string.
@@ 3683-3701 (lines=19) @@
3680
   *
3681
   * @return string
3682
   */
3683
  public static function normalize_msword($str)
3684
  {
3685
    $str = (string)$str;
3686
3687
    if (!isset($str[0])) {
3688
      return '';
3689
    }
3690
3691
    static $UTF8_MSWORD_KEYS_CACHE = null;
3692
    static $UTF8_MSWORD_VALUES_CACHE = null;
3693
3694
    if ($UTF8_MSWORD_KEYS_CACHE === null) {
3695
      $UTF8_MSWORD_KEYS_CACHE = array_keys(self::$UTF8_MSWORD);
3696
      $UTF8_MSWORD_VALUES_CACHE = array_values(self::$UTF8_MSWORD);
3697
    }
3698
3699
    return str_replace($UTF8_MSWORD_KEYS_CACHE, $UTF8_MSWORD_VALUES_CACHE, $str);
3700
  }
3701
3702
  /**
3703
   * Normalize the whitespace.
3704
   *