Code Duplication    Length = 15-15 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 3329-3343 (lines=15) @@
3326
   *
3327
   * @return string <p>The string with unwanted characters stripped from the left.</p>
3328
   */
3329
  public static function ltrim($str = '', $chars = INF)
3330
  {
3331
    $str = (string)$str;
3332
3333
    if (!isset($str[0])) {
3334
      return '';
3335
    }
3336
3337
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
3338
    if ($chars === INF || !$chars) {
3339
      return preg_replace('/^[\pZ\pC]+/u', '', $str);
3340
    }
3341
3342
    return preg_replace('/^' . self::rxClass($chars) . '+/u', '', $str);
3343
  }
3344
3345
  /**
3346
   * Returns the UTF-8 character with the maximum code point in the given data.
@@ 3956-3970 (lines=15) @@
3953
   *
3954
   * @return string <p>The string with unwanted characters stripped from the right.</p>
3955
   */
3956
  public static function rtrim($str = '', $chars = INF)
3957
  {
3958
    $str = (string)$str;
3959
3960
    if (!isset($str[0])) {
3961
      return '';
3962
    }
3963
3964
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
3965
    if ($chars === INF || !$chars) {
3966
      return preg_replace('/[\pZ\pC]+$/u', '', $str);
3967
    }
3968
3969
    return preg_replace('/' . self::rxClass($chars) . '+$/u', '', $str);
3970
  }
3971
3972
  /**
3973
   * rxClass