Code Duplication    Length = 14-20 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

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