Code Duplication    Length = 14-20 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 1230-1249 (lines=20) @@
1227
   *
1228
   * @return string
1229
   */
1230
  public static function cleanup($str)
1231
  {
1232
    $str = (string)$str;
1233
1234
    if (!isset($str[0])) {
1235
      return '';
1236
    }
1237
1238
    // fixed ISO <-> UTF-8 Errors
1239
    $str = self::fix_simple_utf8($str);
1240
1241
    // remove all none UTF-8 symbols
1242
    // && remove diamond question mark (�)
1243
    // && remove remove invisible characters (e.g. "\0")
1244
    // && remove BOM
1245
    // && normalize whitespace chars (but keep non-breaking-spaces)
1246
    $str = self::clean($str, true, true, false, true);
1247
1248
    return (string)$str;
1249
  }
1250
1251
  /**
1252
   * Accepts a string or a array of strings and returns an array of Unicode code points.
@@ 5220-5233 (lines=14) @@
5217
   *
5218
   * @return string <p>The stripped string.</p>
5219
   */
5220
  public static function strip_tags($str, $allowable_tags = null, $cleanUtf8 = false)
5221
  {
5222
    $str = (string)$str;
5223
5224
    if (!isset($str[0])) {
5225
      return '';
5226
    }
5227
5228
    if ($cleanUtf8 === true) {
5229
      $str = self::clean($str);
5230
    }
5231
5232
    return strip_tags($str, $allowable_tags);
5233
  }
5234
5235
  /**
5236
   * Finds position of first occurrence of a string within another, case insensitive.