Code Duplication    Length = 17-17 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 2898-2914 (lines=17) @@
2895
   *
2896
   * @return string <p>The string with unwanted characters stripped from the left.</p>
2897
   */
2898
  public static function ltrim($str = '', $chars = INF)
2899
  {
2900
    $str = (string)$str;
2901
2902
    if (!isset($str[0])) {
2903
      return '';
2904
    }
2905
2906
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
2907
    if ($chars === INF || !$chars) {
2908
      return preg_replace('/^[\pZ\pC]+/u', '', $str);
2909
    }
2910
2911
    $chars = INF === $chars ? '\s' : self::rxClass($chars);
2912
2913
    return preg_replace("/^{$chars}+/u", '', $str);
2914
  }
2915
2916
  /**
2917
   * Returns the UTF-8 character with the maximum code point in the given data.
@@ 3402-3418 (lines=17) @@
3399
   *
3400
   * @return string <p>The string with unwanted characters stripped from the right.</p>
3401
   */
3402
  public static function rtrim($str = '', $chars = INF)
3403
  {
3404
    $str = (string)$str;
3405
3406
    if (!isset($str[0])) {
3407
      return '';
3408
    }
3409
3410
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
3411
    if ($chars === INF || !$chars) {
3412
      return preg_replace('/[\pZ\pC]+$/u', '', $str);
3413
    }
3414
3415
    $chars = INF === $chars ? '\s' : self::rxClass($chars);
3416
3417
    return preg_replace("/{$chars}+$/u", '', $str);
3418
  }
3419
3420
  /**
3421
   * rxClass