Code Duplication    Length = 15-15 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 3327-3341 (lines=15) @@
3324
   *
3325
   * @return string <p>The string with unwanted characters stripped from the left.</p>
3326
   */
3327
  public static function ltrim($str = '', $chars = INF)
3328
  {
3329
    $str = (string)$str;
3330
3331
    if (!isset($str[0])) {
3332
      return '';
3333
    }
3334
3335
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
3336
    if ($chars === INF || !$chars) {
3337
      return preg_replace('/^[\pZ\pC]+/u', '', $str);
3338
    }
3339
3340
    return preg_replace('/^' . self::rxClass($chars) . '+/u', '', $str);
3341
  }
3342
3343
  /**
3344
   * Returns the UTF-8 character with the maximum code point in the given data.
@@ 3976-3990 (lines=15) @@
3973
   *
3974
   * @return string <p>The string with unwanted characters stripped from the right.</p>
3975
   */
3976
  public static function rtrim($str = '', $chars = INF)
3977
  {
3978
    $str = (string)$str;
3979
3980
    if (!isset($str[0])) {
3981
      return '';
3982
    }
3983
3984
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
3985
    if ($chars === INF || !$chars) {
3986
      return preg_replace('/[\pZ\pC]+$/u', '', $str);
3987
    }
3988
3989
    return preg_replace('/' . self::rxClass($chars) . '+$/u', '', $str);
3990
  }
3991
3992
  /**
3993
   * rxClass