Code Duplication    Length = 15-15 lines in 4 locations

src/voku/helper/UTF8.php 4 locations

@@ 4314-4328 (lines=15) @@
4311
   *
4312
   * @return bool
4313
   */
4314
  public static function str_ends_with($haystack, $needle)
4315
  {
4316
    $haystack = (string)$haystack;
4317
    $needle = (string)$needle;
4318
4319
    if (!isset($haystack[0], $needle[0])) {
4320
      return false;
4321
    }
4322
4323
    if ($needle === self::substr($haystack, -self::strlen($needle))) {
4324
      return true;
4325
    }
4326
4327
    return false;
4328
  }
4329
4330
  /**
4331
   * Check if the string ends with the given substring, case insensitive.
@@ 4338-4352 (lines=15) @@
4335
   *
4336
   * @return bool
4337
   */
4338
  public static function str_iends_with($haystack, $needle)
4339
  {
4340
    $haystack = (string)$haystack;
4341
    $needle = (string)$needle;
4342
4343
    if (!isset($haystack[0], $needle[0])) {
4344
      return false;
4345
    }
4346
4347
    if (self::strcasecmp(self::substr($haystack, -self::strlen($needle)), $needle) === 0) {
4348
      return true;
4349
    }
4350
4351
    return false;
4352
  }
4353
4354
  /**
4355
   * Case-insensitive and UTF-8 safe version of <function>str_replace</function>.
@@ 4406-4420 (lines=15) @@
4403
   *
4404
   * @return bool
4405
   */
4406
  public static function str_istarts_with($haystack, $needle)
4407
  {
4408
    $haystack = (string)$haystack;
4409
    $needle = (string)$needle;
4410
4411
    if (!isset($haystack[0], $needle[0])) {
4412
      return false;
4413
    }
4414
4415
    if (self::stripos($haystack, $needle) === 0) {
4416
      return true;
4417
    }
4418
4419
    return false;
4420
  }
4421
4422
  /**
4423
   * Limit the number of characters in a string, but also after the next word.
@@ 4692-4706 (lines=15) @@
4689
   *
4690
   * @return bool
4691
   */
4692
  public static function str_starts_with($haystack, $needle)
4693
  {
4694
    $haystack = (string)$haystack;
4695
    $needle = (string)$needle;
4696
4697
    if (!isset($haystack[0], $needle[0])) {
4698
      return false;
4699
    }
4700
4701
    if (self::strpos($haystack, $needle) === 0) {
4702
      return true;
4703
    }
4704
4705
    return false;
4706
  }
4707
4708
  /**
4709
   * Get a binary representation of a specific string.