Code Duplication    Length = 13-13 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

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