Code Duplication    Length = 14-20 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

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