Code Duplication    Length = 15-15 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 3264-3278 (lines=15) @@
3261
   *
3262
   * @return string <p>The string with unwanted characters stripped from the left.</p>
3263
   */
3264
  public static function ltrim($str = '', $chars = INF)
3265
  {
3266
    $str = (string)$str;
3267
3268
    if (!isset($str[0])) {
3269
      return '';
3270
    }
3271
3272
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
3273
    if ($chars === INF || !$chars) {
3274
      return preg_replace('/^[\pZ\pC]+/u', '', $str);
3275
    }
3276
3277
    return preg_replace('/^' . self::rxClass($chars) . '+/u', '', $str);
3278
  }
3279
3280
  /**
3281
   * Returns the UTF-8 character with the maximum code point in the given data.
@@ 3891-3905 (lines=15) @@
3888
   *
3889
   * @return string <p>The string with unwanted characters stripped from the right.</p>
3890
   */
3891
  public static function rtrim($str = '', $chars = INF)
3892
  {
3893
    $str = (string)$str;
3894
3895
    if (!isset($str[0])) {
3896
      return '';
3897
    }
3898
3899
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
3900
    if ($chars === INF || !$chars) {
3901
      return preg_replace('/[\pZ\pC]+$/u', '', $str);
3902
    }
3903
3904
    return preg_replace('/' . self::rxClass($chars) . '+$/u', '', $str);
3905
  }
3906
3907
  /**
3908
   * rxClass