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.
@@ 3624-3642 (lines=19) @@
3621
   *
3622
   * @return string
3623
   */
3624
  public static function normalize_msword($str)
3625
  {
3626
    $str = (string)$str;
3627
3628
    if (!isset($str[0])) {
3629
      return '';
3630
    }
3631
3632
    static $UTF8_MSWORD_KEYS_CACHE = null;
3633
    static $UTF8_MSWORD_VALUES_CACHE = null;
3634
3635
    if ($UTF8_MSWORD_KEYS_CACHE === null) {
3636
      $UTF8_MSWORD_KEYS_CACHE = array_keys(self::$UTF8_MSWORD);
3637
      $UTF8_MSWORD_VALUES_CACHE = array_values(self::$UTF8_MSWORD);
3638
    }
3639
3640
    return str_replace($UTF8_MSWORD_KEYS_CACHE, $UTF8_MSWORD_VALUES_CACHE, $str);
3641
  }
3642
3643
  /**
3644
   * Normalize the whitespace.
3645
   *