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.
@@ 3677-3695 (lines=19) @@
3674
   *
3675
   * @return string
3676
   */
3677
  public static function normalize_msword($str)
3678
  {
3679
    $str = (string)$str;
3680
3681
    if (!isset($str[0])) {
3682
      return '';
3683
    }
3684
3685
    static $UTF8_MSWORD_KEYS_CACHE = null;
3686
    static $UTF8_MSWORD_VALUES_CACHE = null;
3687
3688
    if ($UTF8_MSWORD_KEYS_CACHE === null) {
3689
      $UTF8_MSWORD_KEYS_CACHE = array_keys(self::$UTF8_MSWORD);
3690
      $UTF8_MSWORD_VALUES_CACHE = array_values(self::$UTF8_MSWORD);
3691
    }
3692
3693
    return str_replace($UTF8_MSWORD_KEYS_CACHE, $UTF8_MSWORD_VALUES_CACHE, $str);
3694
  }
3695
3696
  /**
3697
   * Normalize the whitespace.
3698
   *