Code Duplication    Length = 15-15 lines in 2 locations

includes/libraries/protect/AntiXSS/UTF8.php 2 locations

@@ 3420-3434 (lines=15) @@
3417
   *
3418
   * @return string <p>The string with unwanted characters stripped from the left.</p>
3419
   */
3420
  public static function ltrim($str = '', $chars = INF)
3421
  {
3422
    $str = (string)$str;
3423
3424
    if (!isset($str[0])) {
3425
      return '';
3426
    }
3427
3428
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
3429
    if ($chars === INF || !$chars) {
3430
      return preg_replace('/^[\pZ\pC]+/u', '', $str);
3431
    }
3432
3433
    return preg_replace('/^' . self::rxClass($chars) . '+/u', '', $str);
3434
  }
3435
3436
  /**
3437
   * Returns the UTF-8 character with the maximum code point in the given data.
@@ 4067-4081 (lines=15) @@
4064
   *
4065
   * @return string <p>The string with unwanted characters stripped from the right.</p>
4066
   */
4067
  public static function rtrim($str = '', $chars = INF)
4068
  {
4069
    $str = (string)$str;
4070
4071
    if (!isset($str[0])) {
4072
      return '';
4073
    }
4074
4075
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
4076
    if ($chars === INF || !$chars) {
4077
      return preg_replace('/[\pZ\pC]+$/u', '', $str);
4078
    }
4079
4080
    return preg_replace('/' . self::rxClass($chars) . '+$/u', '', $str);
4081
  }
4082
4083
  /**
4084
   * rxClass