Code Duplication    Length = 15-15 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 3238-3252 (lines=15) @@
3235
   *
3236
   * @return string <p>The string with unwanted characters stripped from the left.</p>
3237
   */
3238
  public static function ltrim($str = '', $chars = INF)
3239
  {
3240
    $str = (string)$str;
3241
3242
    if (!isset($str[0])) {
3243
      return '';
3244
    }
3245
3246
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
3247
    if ($chars === INF || !$chars) {
3248
      return preg_replace('/^[\pZ\pC]+/u', '', $str);
3249
    }
3250
3251
    return preg_replace('/^' . self::rxClass($chars) . '+/u', '', $str);
3252
  }
3253
3254
  /**
3255
   * Returns the UTF-8 character with the maximum code point in the given data.
@@ 3854-3868 (lines=15) @@
3851
   *
3852
   * @return string <p>The string with unwanted characters stripped from the right.</p>
3853
   */
3854
  public static function rtrim($str = '', $chars = INF)
3855
  {
3856
    $str = (string)$str;
3857
3858
    if (!isset($str[0])) {
3859
      return '';
3860
    }
3861
3862
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
3863
    if ($chars === INF || !$chars) {
3864
      return preg_replace('/[\pZ\pC]+$/u', '', $str);
3865
    }
3866
3867
    return preg_replace('/' . self::rxClass($chars) . '+$/u', '', $str);
3868
  }
3869
3870
  /**
3871
   * rxClass