Code Duplication    Length = 15-15 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 3430-3444 (lines=15) @@
3427
   *
3428
   * @return string <p>The string with unwanted characters stripped from the left.</p>
3429
   */
3430
  public static function ltrim($str = '', $chars = INF)
3431
  {
3432
    $str = (string)$str;
3433
3434
    if (!isset($str[0])) {
3435
      return '';
3436
    }
3437
3438
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
3439
    if ($chars === INF || !$chars) {
3440
      return preg_replace('/^[\pZ\pC]+/u', '', $str);
3441
    }
3442
3443
    return preg_replace('/^' . self::rxClass($chars) . '+/u', '', $str);
3444
  }
3445
3446
  /**
3447
   * Returns the UTF-8 character with the maximum code point in the given data.
@@ 4077-4091 (lines=15) @@
4074
   *
4075
   * @return string <p>The string with unwanted characters stripped from the right.</p>
4076
   */
4077
  public static function rtrim($str = '', $chars = INF)
4078
  {
4079
    $str = (string)$str;
4080
4081
    if (!isset($str[0])) {
4082
      return '';
4083
    }
4084
4085
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
4086
    if ($chars === INF || !$chars) {
4087
      return preg_replace('/[\pZ\pC]+$/u', '', $str);
4088
    }
4089
4090
    return preg_replace('/' . self::rxClass($chars) . '+$/u', '', $str);
4091
  }
4092
4093
  /**
4094
   * rxClass