Code Duplication    Length = 15-15 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 3128-3142 (lines=15) @@
3125
   *
3126
   * @return string <p>The string with unwanted characters stripped from the left.</p>
3127
   */
3128
  public static function ltrim($str = '', $chars = INF)
3129
  {
3130
    $str = (string)$str;
3131
3132
    if (!isset($str[0])) {
3133
      return '';
3134
    }
3135
3136
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
3137
    if ($chars === INF || !$chars) {
3138
      return preg_replace('/^[\pZ\pC]+/u', '', $str);
3139
    }
3140
3141
    return preg_replace("/^" . self::rxClass($chars) . "+/u", '', $str);
3142
  }
3143
3144
  /**
3145
   * Returns the UTF-8 character with the maximum code point in the given data.
@@ 3659-3673 (lines=15) @@
3656
   *
3657
   * @return string <p>The string with unwanted characters stripped from the right.</p>
3658
   */
3659
  public static function rtrim($str = '', $chars = INF)
3660
  {
3661
    $str = (string)$str;
3662
3663
    if (!isset($str[0])) {
3664
      return '';
3665
    }
3666
3667
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
3668
    if ($chars === INF || !$chars) {
3669
      return preg_replace('/[\pZ\pC]+$/u', '', $str);
3670
    }
3671
3672
    return preg_replace("/" . self::rxClass($chars) . "+$/u", '', $str);
3673
  }
3674
3675
  /**
3676
   * rxClass