Code Duplication    Length = 19-19 lines in 4 locations

src/voku/helper/UTF8.php 4 locations

@@ 6243-6261 (lines=19) @@
6240
   *
6241
   * @return string <p>Return the sub-string.</p>
6242
   */
6243
  public static function substr_ileft($haystack, $needle)
6244
  {
6245
    // init
6246
    $haystack = (string)$haystack;
6247
    $needle = (string)$needle;
6248
6249
    if (!isset($haystack[0])) {
6250
      return '';
6251
    }
6252
6253
    if (!isset($needle[0])) {
6254
      return $haystack;
6255
    }
6256
6257
    if (self::str_istarts_with($haystack, $needle) === true) {
6258
      $haystack = self::substr($haystack, self::strlen($needle));
6259
    }
6260
6261
    return $haystack;
6262
  }
6263
6264
  /**
@@ 6272-6290 (lines=19) @@
6269
   *
6270
   * @return string <p>Return the sub-string.</p>
6271
   */
6272
  public static function substr_iright($haystack, $needle)
6273
  {
6274
    // init
6275
    $haystack = (string)$haystack;
6276
    $needle = (string)$needle;
6277
6278
    if (!isset($haystack[0])) {
6279
      return '';
6280
    }
6281
6282
    if (!isset($needle[0])) {
6283
      return $haystack;
6284
    }
6285
6286
    if (self::str_iends_with($haystack, $needle) === true) {
6287
      $haystack = self::substr($haystack, 0, self::strlen($haystack) - self::strlen($needle));
6288
    }
6289
6290
    return $haystack;
6291
  }
6292
6293
  /**
@@ 6301-6319 (lines=19) @@
6298
   *
6299
   * @return string <p>Return the sub-string.</p>
6300
   */
6301
  public static function substr_left($haystack, $needle)
6302
  {
6303
    // init
6304
    $haystack = (string)$haystack;
6305
    $needle = (string)$needle;
6306
6307
    if (!isset($haystack[0])) {
6308
      return '';
6309
    }
6310
6311
    if (!isset($needle[0])) {
6312
      return $haystack;
6313
    }
6314
6315
    if (self::str_starts_with($haystack, $needle) === true) {
6316
      $haystack = self::substr($haystack, self::strlen($needle));
6317
    }
6318
6319
    return $haystack;
6320
  }
6321
6322
  /**
@@ 6428-6446 (lines=19) @@
6425
   *
6426
   * @return string <p>Return the sub-string.</p>
6427
   */
6428
  public static function substr_right($haystack, $needle)
6429
  {
6430
    $haystack = (string)$haystack;
6431
    $needle = (string)$needle;
6432
6433
    if (!isset($haystack[0])) {
6434
      return '';
6435
    }
6436
6437
    if (!isset($needle[0])) {
6438
      return $haystack;
6439
    }
6440
6441
    if (self::str_ends_with($haystack, $needle) === true) {
6442
      $haystack = self::substr($haystack, 0, self::strlen($haystack) - self::strlen($needle));
6443
    }
6444
6445
    return $haystack;
6446
  }
6447
6448
  /**
6449
   * Returns a case swapped version of the string.