Code Duplication    Length = 19-19 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 1848-1866 (lines=19) @@
1845
   *
1846
   * @return string
1847
   */
1848
  public static function fix_simple_utf8($str)
1849
  {
1850
    // init
1851
    $str = (string)$str;
1852
1853
    if (!isset($str[0])) {
1854
      return '';
1855
    }
1856
1857
    static $BROKEN_UTF8_TO_UTF8_KEYS_CACHE = null;
1858
    static $BROKEN_UTF8_TO_UTF8_VALUES_CACHE = null;
1859
1860
    if ($BROKEN_UTF8_TO_UTF8_KEYS_CACHE === null) {
1861
      $BROKEN_UTF8_TO_UTF8_KEYS_CACHE = array_keys(self::$BROKEN_UTF8_FIX);
1862
      $BROKEN_UTF8_TO_UTF8_VALUES_CACHE = array_values(self::$BROKEN_UTF8_FIX);
1863
    }
1864
1865
    return str_replace($BROKEN_UTF8_TO_UTF8_KEYS_CACHE, $BROKEN_UTF8_TO_UTF8_VALUES_CACHE, $str);
1866
  }
1867
1868
  /**
1869
   * Fix a double (or multiple) encoded UTF8 string.
@@ 3673-3691 (lines=19) @@
3670
   *
3671
   * @return string
3672
   */
3673
  public static function normalize_msword($str)
3674
  {
3675
    $str = (string)$str;
3676
3677
    if (!isset($str[0])) {
3678
      return '';
3679
    }
3680
3681
    static $UTF8_MSWORD_KEYS_CACHE = null;
3682
    static $UTF8_MSWORD_VALUES_CACHE = null;
3683
3684
    if ($UTF8_MSWORD_KEYS_CACHE === null) {
3685
      $UTF8_MSWORD_KEYS_CACHE = array_keys(self::$UTF8_MSWORD);
3686
      $UTF8_MSWORD_VALUES_CACHE = array_values(self::$UTF8_MSWORD);
3687
    }
3688
3689
    return str_replace($UTF8_MSWORD_KEYS_CACHE, $UTF8_MSWORD_VALUES_CACHE, $str);
3690
  }
3691
3692
  /**
3693
   * Normalize the whitespace.
3694
   *