Code Duplication    Length = 38-38 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

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