Code Duplication    Length = 38-38 lines in 2 locations

includes/libraries/protect/AntiXSS/UTF8.php 2 locations

@@ 3373-3410 (lines=38) @@
3370
   *
3371
   * @return string
3372
   */
3373
  public static function lcwords($str, $exceptions = array(), $charlist = '', $encoding = 'UTF-8', $cleanUtf8 = false)
3374
  {
3375
    if (!$str) {
3376
      return '';
3377
    }
3378
3379
    $words = self::str_to_words($str, $charlist);
3380
    $newWords = array();
3381
3382
    if (count($exceptions) > 0) {
3383
      $useExceptions = true;
3384
    } else {
3385
      $useExceptions = false;
3386
    }
3387
3388
    foreach ($words as $word) {
3389
3390
      if (!$word) {
3391
        continue;
3392
      }
3393
3394
      if (
3395
          $useExceptions === false
3396
          ||
3397
          (
3398
              $useExceptions === true
3399
              &&
3400
              !in_array($word, $exceptions, true)
3401
          )
3402
      ) {
3403
        $word = self::lcfirst($word, $encoding, $cleanUtf8);
3404
      }
3405
3406
      $newWords[] = $word;
3407
    }
3408
3409
    return implode('', $newWords);
3410
  }
3411
3412
  /**
3413
   * Strip whitespace or other characters from beginning of a UTF-8 string.
@@ 7292-7329 (lines=38) @@
7289
   *
7290
   * @return string
7291
   */
7292
  public static function ucwords($str, $exceptions = array(), $charlist = '', $encoding = 'UTF-8', $cleanUtf8 = false)
7293
  {
7294
    if (!$str) {
7295
      return '';
7296
    }
7297
7298
    $words = self::str_to_words($str, $charlist);
7299
    $newWords = array();
7300
7301
    if (count($exceptions) > 0) {
7302
      $useExceptions = true;
7303
    } else {
7304
      $useExceptions = false;
7305
    }
7306
7307
    foreach ($words as $word) {
7308
7309
      if (!$word) {
7310
        continue;
7311
      }
7312
7313
      if (
7314
          $useExceptions === false
7315
          ||
7316
          (
7317
              $useExceptions === true
7318
              &&
7319
              !in_array($word, $exceptions, true)
7320
          )
7321
      ) {
7322
        $word = self::ucfirst($word, $encoding, $cleanUtf8);
7323
      }
7324
7325
      $newWords[] = $word;
7326
    }
7327
7328
    return implode('', $newWords);
7329
  }
7330
7331
  /**
7332
   * Multi decode html entity & fix urlencoded-win1252-chars.