Code Duplication    Length = 15-15 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 3335-3349 (lines=15) @@
3332
   *
3333
   * @return string <p>The string with unwanted characters stripped from the left.</p>
3334
   */
3335
  public static function ltrim($str = '', $chars = INF)
3336
  {
3337
    $str = (string)$str;
3338
3339
    if (!isset($str[0])) {
3340
      return '';
3341
    }
3342
3343
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
3344
    if ($chars === INF || !$chars) {
3345
      return preg_replace('/^[\pZ\pC]+/u', '', $str);
3346
    }
3347
3348
    return preg_replace('/^' . self::rxClass($chars) . '+/u', '', $str);
3349
  }
3350
3351
  /**
3352
   * Returns the UTF-8 character with the maximum code point in the given data.
@@ 3984-3998 (lines=15) @@
3981
   *
3982
   * @return string <p>The string with unwanted characters stripped from the right.</p>
3983
   */
3984
  public static function rtrim($str = '', $chars = INF)
3985
  {
3986
    $str = (string)$str;
3987
3988
    if (!isset($str[0])) {
3989
      return '';
3990
    }
3991
3992
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
3993
    if ($chars === INF || !$chars) {
3994
      return preg_replace('/[\pZ\pC]+$/u', '', $str);
3995
    }
3996
3997
    return preg_replace('/' . self::rxClass($chars) . '+$/u', '', $str);
3998
  }
3999
4000
  /**
4001
   * rxClass