Code Duplication    Length = 15-15 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 3142-3156 (lines=15) @@
3139
   *
3140
   * @return string <p>The string with unwanted characters stripped from the left.</p>
3141
   */
3142
  public static function ltrim($str = '', $chars = INF)
3143
  {
3144
    $str = (string)$str;
3145
3146
    if (!isset($str[0])) {
3147
      return '';
3148
    }
3149
3150
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
3151
    if ($chars === INF || !$chars) {
3152
      return preg_replace('/^[\pZ\pC]+/u', '', $str);
3153
    }
3154
3155
    return preg_replace('/^' . self::rxClass($chars) . '+/u', '', $str);
3156
  }
3157
3158
  /**
3159
   * Returns the UTF-8 character with the maximum code point in the given data.
@@ 3724-3738 (lines=15) @@
3721
   *
3722
   * @return string <p>The string with unwanted characters stripped from the right.</p>
3723
   */
3724
  public static function rtrim($str = '', $chars = INF)
3725
  {
3726
    $str = (string)$str;
3727
3728
    if (!isset($str[0])) {
3729
      return '';
3730
    }
3731
3732
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
3733
    if ($chars === INF || !$chars) {
3734
      return preg_replace('/[\pZ\pC]+$/u', '', $str);
3735
    }
3736
3737
    return preg_replace('/' . self::rxClass($chars) . '+$/u', '', $str);
3738
  }
3739
3740
  /**
3741
   * rxClass