Code Duplication    Length = 13-13 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 2815-2827 (lines=13) @@
2812
   *
2813
   * @return string <p>The string with unwanted characters stripped from the left.</p>
2814
   */
2815
  public static function ltrim(string $str = '', $chars = INF): string
2816
  {
2817
    if (!isset($str[0])) {
2818
      return '';
2819
    }
2820
2821
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
2822
    if ($chars === INF || !$chars) {
2823
      return \preg_replace('/^[\pZ\pC]+/u', '', $str);
2824
    }
2825
2826
    return \preg_replace('/^' . self::rxClass($chars) . '+/u', '', $str);
2827
  }
2828
2829
  /**
2830
   * Returns the UTF-8 character with the maximum code point in the given data.
@@ 3466-3478 (lines=13) @@
3463
   *
3464
   * @return string <p>The string with unwanted characters stripped from the right.</p>
3465
   */
3466
  public static function rtrim(string $str = '', $chars = INF): string
3467
  {
3468
    if (!isset($str[0])) {
3469
      return '';
3470
    }
3471
3472
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
3473
    if ($chars === INF || !$chars) {
3474
      return \preg_replace('/[\pZ\pC]+$/u', '', $str);
3475
    }
3476
3477
    return \preg_replace('/' . self::rxClass($chars) . '+$/u', '', $str);
3478
  }
3479
3480
  /**
3481
   * rxClass