Code Duplication    Length = 15-15 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

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