Code Duplication    Length = 15-15 lines in 4 locations

src/voku/helper/UTF8.php 4 locations

@@ 4237-4251 (lines=15) @@
4234
   *
4235
   * @return bool
4236
   */
4237
  public static function str_ends_with($haystack, $needle)
4238
  {
4239
    $haystack = (string)$haystack;
4240
    $needle = (string)$needle;
4241
4242
    if (!isset($haystack[0], $needle[0])) {
4243
      return false;
4244
    }
4245
4246
    if ($needle === self::substr($haystack, -self::strlen($needle))) {
4247
      return true;
4248
    }
4249
4250
    return false;
4251
  }
4252
4253
  /**
4254
   * Check if the string ends with the given substring, case insensitive.
@@ 4261-4275 (lines=15) @@
4258
   *
4259
   * @return bool
4260
   */
4261
  public static function str_iends_with($haystack, $needle)
4262
  {
4263
    $haystack = (string)$haystack;
4264
    $needle = (string)$needle;
4265
4266
    if (!isset($haystack[0], $needle[0])) {
4267
      return false;
4268
    }
4269
4270
    if (self::strcasecmp(self::substr($haystack, -self::strlen($needle)), $needle) === 0) {
4271
      return true;
4272
    }
4273
4274
    return false;
4275
  }
4276
4277
  /**
4278
   * Case-insensitive and UTF-8 safe version of <function>str_replace</function>.
@@ 4329-4343 (lines=15) @@
4326
   *
4327
   * @return bool
4328
   */
4329
  public static function str_istarts_with($haystack, $needle)
4330
  {
4331
    $haystack = (string)$haystack;
4332
    $needle = (string)$needle;
4333
4334
    if (!isset($haystack[0], $needle[0])) {
4335
      return false;
4336
    }
4337
4338
    if (self::stripos($haystack, $needle) === 0) {
4339
      return true;
4340
    }
4341
4342
    return false;
4343
  }
4344
4345
  /**
4346
   * Limit the number of characters in a string, but also after the next word.
@@ 4615-4629 (lines=15) @@
4612
   *
4613
   * @return bool
4614
   */
4615
  public static function str_starts_with($haystack, $needle)
4616
  {
4617
    $haystack = (string)$haystack;
4618
    $needle = (string)$needle;
4619
4620
    if (!isset($haystack[0], $needle[0])) {
4621
      return false;
4622
    }
4623
4624
    if (self::strpos($haystack, $needle) === 0) {
4625
      return true;
4626
    }
4627
4628
    return false;
4629
  }
4630
4631
  /**
4632
   * Get a binary representation of a specific string.