Code Duplication    Length = 15-15 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 3280-3294 (lines=15) @@
3277
   *
3278
   * @return string <p>The string with unwanted characters stripped from the left.</p>
3279
   */
3280
  public static function ltrim($str = '', $chars = INF)
3281
  {
3282
    $str = (string)$str;
3283
3284
    if (!isset($str[0])) {
3285
      return '';
3286
    }
3287
3288
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
3289
    if ($chars === INF || !$chars) {
3290
      return preg_replace('/^[\pZ\pC]+/u', '', $str);
3291
    }
3292
3293
    return preg_replace('/^' . self::rxClass($chars) . '+/u', '', $str);
3294
  }
3295
3296
  /**
3297
   * Returns the UTF-8 character with the maximum code point in the given data.
@@ 3907-3921 (lines=15) @@
3904
   *
3905
   * @return string <p>The string with unwanted characters stripped from the right.</p>
3906
   */
3907
  public static function rtrim($str = '', $chars = INF)
3908
  {
3909
    $str = (string)$str;
3910
3911
    if (!isset($str[0])) {
3912
      return '';
3913
    }
3914
3915
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
3916
    if ($chars === INF || !$chars) {
3917
      return preg_replace('/[\pZ\pC]+$/u', '', $str);
3918
    }
3919
3920
    return preg_replace('/' . self::rxClass($chars) . '+$/u', '', $str);
3921
  }
3922
3923
  /**
3924
   * rxClass