Code Duplication    Length = 19-19 lines in 4 locations

src/voku/helper/UTF8.php 4 locations

@@ 6223-6241 (lines=19) @@
6220
   *
6221
   * @return string <p>Return the sub-string.</p>
6222
   */
6223
  public static function substr_ileft($haystack, $needle)
6224
  {
6225
    // init
6226
    $haystack = (string)$haystack;
6227
    $needle = (string)$needle;
6228
6229
    if (!isset($haystack[0])) {
6230
      return '';
6231
    }
6232
6233
    if (!isset($needle[0])) {
6234
      return $haystack;
6235
    }
6236
6237
    if (self::str_istarts_with($haystack, $needle) === true) {
6238
      $haystack = self::substr($haystack, self::strlen($needle));
6239
    }
6240
6241
    return $haystack;
6242
  }
6243
6244
  /**
@@ 6252-6270 (lines=19) @@
6249
   *
6250
   * @return string <p>Return the sub-string.</p>
6251
   */
6252
  public static function substr_iright($haystack, $needle)
6253
  {
6254
    // init
6255
    $haystack = (string)$haystack;
6256
    $needle = (string)$needle;
6257
6258
    if (!isset($haystack[0])) {
6259
      return '';
6260
    }
6261
6262
    if (!isset($needle[0])) {
6263
      return $haystack;
6264
    }
6265
6266
    if (self::str_iends_with($haystack, $needle) === true) {
6267
      $haystack = self::substr($haystack, 0, self::strlen($haystack) - self::strlen($needle));
6268
    }
6269
6270
    return $haystack;
6271
  }
6272
6273
  /**
@@ 6281-6299 (lines=19) @@
6278
   *
6279
   * @return string <p>Return the sub-string.</p>
6280
   */
6281
  public static function substr_left($haystack, $needle)
6282
  {
6283
    // init
6284
    $haystack = (string)$haystack;
6285
    $needle = (string)$needle;
6286
6287
    if (!isset($haystack[0])) {
6288
      return '';
6289
    }
6290
6291
    if (!isset($needle[0])) {
6292
      return $haystack;
6293
    }
6294
6295
    if (self::str_starts_with($haystack, $needle) === true) {
6296
      $haystack = self::substr($haystack, self::strlen($needle));
6297
    }
6298
6299
    return $haystack;
6300
  }
6301
6302
  /**
@@ 6408-6426 (lines=19) @@
6405
   *
6406
   * @return string <p>Return the sub-string.</p>
6407
   */
6408
  public static function substr_right($haystack, $needle)
6409
  {
6410
    $haystack = (string)$haystack;
6411
    $needle = (string)$needle;
6412
6413
    if (!isset($haystack[0])) {
6414
      return '';
6415
    }
6416
6417
    if (!isset($needle[0])) {
6418
      return $haystack;
6419
    }
6420
6421
    if (self::str_ends_with($haystack, $needle) === true) {
6422
      $haystack = self::substr($haystack, 0, self::strlen($haystack) - self::strlen($needle));
6423
    }
6424
6425
    return $haystack;
6426
  }
6427
6428
  /**
6429
   * Returns a case swapped version of the string.