Code Duplication    Length = 15-15 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 3231-3245 (lines=15) @@
3228
   *
3229
   * @return string <p>The string with unwanted characters stripped from the left.</p>
3230
   */
3231
  public static function ltrim($str = '', $chars = INF)
3232
  {
3233
    $str = (string)$str;
3234
3235
    if (!isset($str[0])) {
3236
      return '';
3237
    }
3238
3239
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
3240
    if ($chars === INF || !$chars) {
3241
      return preg_replace('/^[\pZ\pC]+/u', '', $str);
3242
    }
3243
3244
    return preg_replace('/^' . self::rxClass($chars) . '+/u', '', $str);
3245
  }
3246
3247
  /**
3248
   * Returns the UTF-8 character with the maximum code point in the given data.
@@ 3847-3861 (lines=15) @@
3844
   *
3845
   * @return string <p>The string with unwanted characters stripped from the right.</p>
3846
   */
3847
  public static function rtrim($str = '', $chars = INF)
3848
  {
3849
    $str = (string)$str;
3850
3851
    if (!isset($str[0])) {
3852
      return '';
3853
    }
3854
3855
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
3856
    if ($chars === INF || !$chars) {
3857
      return preg_replace('/[\pZ\pC]+$/u', '', $str);
3858
    }
3859
3860
    return preg_replace('/' . self::rxClass($chars) . '+$/u', '', $str);
3861
  }
3862
3863
  /**
3864
   * rxClass