Code Duplication    Length = 19-19 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 1850-1868 (lines=19) @@
1847
   *
1848
   * @return string
1849
   */
1850
  public static function fix_simple_utf8($str)
1851
  {
1852
    // init
1853
    $str = (string)$str;
1854
1855
    if (!isset($str[0])) {
1856
      return '';
1857
    }
1858
1859
    static $BROKEN_UTF8_TO_UTF8_KEYS_CACHE = null;
1860
    static $BROKEN_UTF8_TO_UTF8_VALUES_CACHE = null;
1861
1862
    if ($BROKEN_UTF8_TO_UTF8_KEYS_CACHE === null) {
1863
      $BROKEN_UTF8_TO_UTF8_KEYS_CACHE = array_keys(self::$BROKEN_UTF8_FIX);
1864
      $BROKEN_UTF8_TO_UTF8_VALUES_CACHE = array_values(self::$BROKEN_UTF8_FIX);
1865
    }
1866
1867
    return str_replace($BROKEN_UTF8_TO_UTF8_KEYS_CACHE, $BROKEN_UTF8_TO_UTF8_VALUES_CACHE, $str);
1868
  }
1869
1870
  /**
1871
   * Fix a double (or multiple) encoded UTF8 string.
@@ 3692-3710 (lines=19) @@
3689
   *
3690
   * @return string
3691
   */
3692
  public static function normalize_msword($str)
3693
  {
3694
    $str = (string)$str;
3695
3696
    if (!isset($str[0])) {
3697
      return '';
3698
    }
3699
3700
    static $UTF8_MSWORD_KEYS_CACHE = null;
3701
    static $UTF8_MSWORD_VALUES_CACHE = null;
3702
3703
    if ($UTF8_MSWORD_KEYS_CACHE === null) {
3704
      $UTF8_MSWORD_KEYS_CACHE = array_keys(self::$UTF8_MSWORD);
3705
      $UTF8_MSWORD_VALUES_CACHE = array_values(self::$UTF8_MSWORD);
3706
    }
3707
3708
    return \str_replace($UTF8_MSWORD_KEYS_CACHE, $UTF8_MSWORD_VALUES_CACHE, $str);
3709
  }
3710
3711
  /**
3712
   * Normalize the whitespace.
3713
   *