Code Duplication    Length = 15-15 lines in 4 locations

src/voku/helper/UTF8.php 4 locations

@@ 3791-3805 (lines=15) @@
3788
   *
3789
   * @return bool
3790
   */
3791
  public static function str_ends_with($haystack, $needle)
3792
  {
3793
    $haystack = (string)$haystack;
3794
    $needle = (string)$needle;
3795
3796
    if (!isset($haystack[0], $needle[0])) {
3797
      return false;
3798
    }
3799
3800
    if ($needle === self::substr($haystack, -self::strlen($needle))) {
3801
      return true;
3802
    }
3803
3804
    return false;
3805
  }
3806
3807
  /**
3808
   * Check if the string ends with the given substring, case insensitive.
@@ 3815-3829 (lines=15) @@
3812
   *
3813
   * @return bool
3814
   */
3815
  public static function str_iends_with($haystack, $needle)
3816
  {
3817
    $haystack = (string)$haystack;
3818
    $needle = (string)$needle;
3819
3820
    if (!isset($haystack[0], $needle[0])) {
3821
      return false;
3822
    }
3823
3824
    if (self::strcasecmp(self::substr($haystack, -self::strlen($needle)), $needle) === 0) {
3825
      return true;
3826
    }
3827
3828
    return false;
3829
  }
3830
3831
  /**
3832
   * Case-insensitive and UTF-8 safe version of <function>str_replace</function>.
@@ 3883-3897 (lines=15) @@
3880
   *
3881
   * @return bool
3882
   */
3883
  public static function str_istarts_with($haystack, $needle)
3884
  {
3885
    $haystack = (string)$haystack;
3886
    $needle = (string)$needle;
3887
3888
    if (!isset($haystack[0], $needle[0])) {
3889
      return false;
3890
    }
3891
3892
    if (self::stripos($haystack, $needle) === 0) {
3893
      return true;
3894
    }
3895
3896
    return false;
3897
  }
3898
3899
  /**
3900
   * Limit the number of characters in a string, but also after the next word.
@@ 4149-4163 (lines=15) @@
4146
   *
4147
   * @return bool
4148
   */
4149
  public static function str_starts_with($haystack, $needle)
4150
  {
4151
    $haystack = (string)$haystack;
4152
    $needle = (string)$needle;
4153
4154
    if (!isset($haystack[0], $needle[0])) {
4155
      return false;
4156
    }
4157
4158
    if (self::strpos($haystack, $needle) === 0) {
4159
      return true;
4160
    }
4161
4162
    return false;
4163
  }
4164
4165
  /**
4166
   * Get a binary representation of a specific string.