Code Duplication    Length = 19-19 lines in 4 locations

src/voku/helper/UTF8.php 4 locations

@@ 6298-6316 (lines=19) @@
6295
   *
6296
   * @return string <p>Return the sub-string.</p>
6297
   */
6298
  public static function substr_ileft($haystack, $needle)
6299
  {
6300
    // init
6301
    $haystack = (string)$haystack;
6302
    $needle = (string)$needle;
6303
6304
    if (!isset($haystack[0])) {
6305
      return '';
6306
    }
6307
6308
    if (!isset($needle[0])) {
6309
      return $haystack;
6310
    }
6311
6312
    if (self::str_istarts_with($haystack, $needle) === true) {
6313
      $haystack = self::substr($haystack, self::strlen($needle));
6314
    }
6315
6316
    return $haystack;
6317
  }
6318
6319
  /**
@@ 6327-6345 (lines=19) @@
6324
   *
6325
   * @return string <p>Return the sub-string.</p>
6326
   */
6327
  public static function substr_iright($haystack, $needle)
6328
  {
6329
    // init
6330
    $haystack = (string)$haystack;
6331
    $needle = (string)$needle;
6332
6333
    if (!isset($haystack[0])) {
6334
      return '';
6335
    }
6336
6337
    if (!isset($needle[0])) {
6338
      return $haystack;
6339
    }
6340
6341
    if (self::str_iends_with($haystack, $needle) === true) {
6342
      $haystack = self::substr($haystack, 0, self::strlen($haystack) - self::strlen($needle));
6343
    }
6344
6345
    return $haystack;
6346
  }
6347
6348
  /**
@@ 6356-6374 (lines=19) @@
6353
   *
6354
   * @return string <p>Return the sub-string.</p>
6355
   */
6356
  public static function substr_left($haystack, $needle)
6357
  {
6358
    // init
6359
    $haystack = (string)$haystack;
6360
    $needle = (string)$needle;
6361
6362
    if (!isset($haystack[0])) {
6363
      return '';
6364
    }
6365
6366
    if (!isset($needle[0])) {
6367
      return $haystack;
6368
    }
6369
6370
    if (self::str_starts_with($haystack, $needle) === true) {
6371
      $haystack = self::substr($haystack, self::strlen($needle));
6372
    }
6373
6374
    return $haystack;
6375
  }
6376
6377
  /**
@@ 6482-6500 (lines=19) @@
6479
   *
6480
   * @return string <p>Return the sub-string.</p>
6481
   */
6482
  public static function substr_right($haystack, $needle)
6483
  {
6484
    $haystack = (string)$haystack;
6485
    $needle = (string)$needle;
6486
6487
    if (!isset($haystack[0])) {
6488
      return '';
6489
    }
6490
6491
    if (!isset($needle[0])) {
6492
      return $haystack;
6493
    }
6494
6495
    if (self::str_ends_with($haystack, $needle) === true) {
6496
      $haystack = self::substr($haystack, 0, self::strlen($haystack) - self::strlen($needle));
6497
    }
6498
6499
    return $haystack;
6500
  }
6501
6502
  /**
6503
   * Returns a case swapped version of the string.