Code Duplication    Length = 15-15 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 3460-3474 (lines=15) @@
3457
   *
3458
   * @return string <p>The string with unwanted characters stripped from the left.</p>
3459
   */
3460
  public static function ltrim($str = '', $chars = INF)
3461
  {
3462
    $str = (string)$str;
3463
3464
    if (!isset($str[0])) {
3465
      return '';
3466
    }
3467
3468
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
3469
    if ($chars === INF || !$chars) {
3470
      return preg_replace('/^[\pZ\pC]+/u', '', $str);
3471
    }
3472
3473
    return preg_replace('/^' . self::rxClass($chars) . '+/u', '', $str);
3474
  }
3475
3476
  /**
3477
   * Returns the UTF-8 character with the maximum code point in the given data.
@@ 4158-4172 (lines=15) @@
4155
   *
4156
   * @return string <p>The string with unwanted characters stripped from the right.</p>
4157
   */
4158
  public static function rtrim($str = '', $chars = INF)
4159
  {
4160
    $str = (string)$str;
4161
4162
    if (!isset($str[0])) {
4163
      return '';
4164
    }
4165
4166
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
4167
    if ($chars === INF || !$chars) {
4168
      return preg_replace('/[\pZ\pC]+$/u', '', $str);
4169
    }
4170
4171
    return preg_replace('/' . self::rxClass($chars) . '+$/u', '', $str);
4172
  }
4173
4174
  /**
4175
   * rxClass