Code Duplication    Length = 17-17 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 4390-4406 (lines=17) @@
4387
   *
4388
   * @return   string The string with unwanted characters stripped from the right
4389
   */
4390
  public static function rtrim($str = '', $chars = INF)
4391
  {
4392
    $str = (string)$str;
4393
4394
    if (!isset($str[0])) {
4395
      return '';
4396
    }
4397
4398
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
4399
    if ($chars === INF || !$chars) {
4400
      return preg_replace('/[\pZ\pC]+$/u', '', $str);
4401
    }
4402
4403
    $chars = INF === $chars ? '\s' : self::rxClass($chars);
4404
4405
    return preg_replace("/{$chars}+$/u", '', $str);
4406
  }
4407
4408
  /**
4409
   * rxClass
@@ 3884-3900 (lines=17) @@
3881
   *
3882
   * @return string The string with unwanted characters stripped from the left
3883
   */
3884
  public static function ltrim($str = '', $chars = INF)
3885
  {
3886
    $str = (string)$str;
3887
3888
    if (!isset($str[0])) {
3889
      return '';
3890
    }
3891
3892
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
3893
    if ($chars === INF || !$chars) {
3894
      return preg_replace('/^[\pZ\pC]+/u', '', $str);
3895
    }
3896
3897
    $chars = INF === $chars ? '\s' : self::rxClass($chars);
3898
3899
    return preg_replace("/^{$chars}+/u", '', $str);
3900
  }
3901
3902
  /**
3903
   * Returns the UTF-8 character with the maximum code point in the given data.