Code Duplication    Length = 15-15 lines in 2 locations

src/voku/helper/UTF8.php 2 locations

@@ 3461-3475 (lines=15) @@
3458
   *
3459
   * @return string <p>The string with unwanted characters stripped from the left.</p>
3460
   */
3461
  public static function ltrim($str = '', $chars = INF)
3462
  {
3463
    $str = (string)$str;
3464
3465
    if (!isset($str[0])) {
3466
      return '';
3467
    }
3468
3469
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
3470
    if ($chars === INF || !$chars) {
3471
      return preg_replace('/^[\pZ\pC]+/u', '', $str);
3472
    }
3473
3474
    return preg_replace('/^' . self::rxClass($chars) . '+/u', '', $str);
3475
  }
3476
3477
  /**
3478
   * Returns the UTF-8 character with the maximum code point in the given data.
@@ 4159-4173 (lines=15) @@
4156
   *
4157
   * @return string <p>The string with unwanted characters stripped from the right.</p>
4158
   */
4159
  public static function rtrim($str = '', $chars = INF)
4160
  {
4161
    $str = (string)$str;
4162
4163
    if (!isset($str[0])) {
4164
      return '';
4165
    }
4166
4167
    // Info: http://nadeausoftware.com/articles/2007/9/php_tip_how_strip_punctuation_characters_web_page#Unicodecharactercategories
4168
    if ($chars === INF || !$chars) {
4169
      return preg_replace('/[\pZ\pC]+$/u', '', $str);
4170
    }
4171
4172
    return preg_replace('/' . self::rxClass($chars) . '+$/u', '', $str);
4173
  }
4174
4175
  /**
4176
   * rxClass