Code Duplication    Length = 17-17 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

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