Code Duplication    Length = 15-15 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

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