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.
@@ 4162-4176 (lines=15) @@
4159
   *
4160
   * @return string <p>The string with unwanted characters stripped from the right.</p>
4161
   */
4162
  public static function rtrim($str = '', $chars = INF)
4163
  {
4164
    $str = (string)$str;
4165
4166
    if (!isset($str[0])) {
4167
      return '';
4168
    }
4169
4170
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
4171
    if ($chars === INF || !$chars) {
4172
      return preg_replace('/[\pZ\pC]+$/u', '', $str);
4173
    }
4174
4175
    return preg_replace('/' . self::rxClass($chars) . '+$/u', '', $str);
4176
  }
4177
4178
  /**
4179
   * rxClass