Code Duplication    Length = 17-17 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 2937-2953 (lines=17) @@
2934
   *
2935
   * @return string <p>The string with unwanted characters stripped from the left.</p>
2936
   */
2937
  public static function ltrim($str = '', $chars = INF)
2938
  {
2939
    $str = (string)$str;
2940
2941
    if (!isset($str[0])) {
2942
      return '';
2943
    }
2944
2945
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
2946
    if ($chars === INF || !$chars) {
2947
      return preg_replace('/^[\pZ\pC]+/u', '', $str);
2948
    }
2949
2950
    $chars = INF === $chars ? '\s' : self::rxClass($chars);
2951
2952
    return preg_replace("/^{$chars}+/u", '', $str);
2953
  }
2954
2955
  /**
2956
   * Returns the UTF-8 character with the maximum code point in the given data.
@@ 3448-3464 (lines=17) @@
3445
   *
3446
   * @return string <p>The string with unwanted characters stripped from the right.</p>
3447
   */
3448
  public static function rtrim($str = '', $chars = INF)
3449
  {
3450
    $str = (string)$str;
3451
3452
    if (!isset($str[0])) {
3453
      return '';
3454
    }
3455
3456
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
3457
    if ($chars === INF || !$chars) {
3458
      return preg_replace('/[\pZ\pC]+$/u', '', $str);
3459
    }
3460
3461
    $chars = INF === $chars ? '\s' : self::rxClass($chars);
3462
3463
    return preg_replace("/{$chars}+$/u", '', $str);
3464
  }
3465
3466
  /**
3467
   * rxClass