Code Duplication    Length = 19-19 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 1803-1821 (lines=19) @@
1800
   *
1801
   * @return string
1802
   */
1803
  public static function fix_simple_utf8($str)
1804
  {
1805
    // init
1806
    $str = (string)$str;
1807
1808
    if (!isset($str[0])) {
1809
      return '';
1810
    }
1811
1812
    static $BROKEN_UTF8_TO_UTF8_KEYS_CACHE = null;
1813
    static $BROKEN_UTF8_TO_UTF8_VALUES_CACHE = null;
1814
1815
    if ($BROKEN_UTF8_TO_UTF8_KEYS_CACHE === null) {
1816
      $BROKEN_UTF8_TO_UTF8_KEYS_CACHE = array_keys(self::$BROKEN_UTF8_FIX);
1817
      $BROKEN_UTF8_TO_UTF8_VALUES_CACHE = array_values(self::$BROKEN_UTF8_FIX);
1818
    }
1819
1820
    return str_replace($BROKEN_UTF8_TO_UTF8_KEYS_CACHE, $BROKEN_UTF8_TO_UTF8_VALUES_CACHE, $str);
1821
  }
1822
1823
  /**
1824
   * Fix a double (or multiple) encoded UTF8 string.
@@ 3444-3462 (lines=19) @@
3441
   *
3442
   * @return string
3443
   */
3444
  public static function normalize_msword($str)
3445
  {
3446
    // init
3447
    $str = (string)$str;
3448
3449
    if (!isset($str[0])) {
3450
      return '';
3451
    }
3452
3453
    static $UTF8_MSWORD_KEYS_CACHE = null;
3454
    static $UTF8_MSWORD_VALUES_CACHE = null;
3455
3456
    if ($UTF8_MSWORD_KEYS_CACHE === null) {
3457
      $UTF8_MSWORD_KEYS_CACHE = array_keys(self::$UTF8_MSWORD);
3458
      $UTF8_MSWORD_VALUES_CACHE = array_values(self::$UTF8_MSWORD);
3459
    }
3460
3461
    return str_replace($UTF8_MSWORD_KEYS_CACHE, $UTF8_MSWORD_VALUES_CACHE, $str);
3462
  }
3463
3464
  /**
3465
   * Normalize the whitespace.