Code Duplication    Length = 15-15 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

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