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.
@@ 5164-5177 (lines=14) @@
5161
   *
5162
   * @return string <p>The stripped string.</p>
5163
   */
5164
  public static function strip_tags($str, $allowable_tags = null, $cleanUtf8 = false)
5165
  {
5166
    $str = (string)$str;
5167
5168
    if (!isset($str[0])) {
5169
      return '';
5170
    }
5171
5172
    if ($cleanUtf8 === true) {
5173
      $str = self::clean($str);
5174
    }
5175
5176
    return strip_tags($str, $allowable_tags);
5177
  }
5178
5179
  /**
5180
   * Finds position of first occurrence of a string within another, case insensitive.