Code Duplication    Length = 19-19 lines in 4 locations

src/voku/helper/UTF8.php 4 locations

@@ 5853-5871 (lines=19) @@
5850
   *
5851
   * @return string <p>Return the sub-string.</p>
5852
   */
5853
  public static function substr_ileft($haystack, $needle)
5854
  {
5855
    // init
5856
    $haystack = (string)$haystack;
5857
    $needle = (string)$needle;
5858
5859
    if (!isset($haystack[0])) {
5860
      return '';
5861
    }
5862
5863
    if (!isset($needle[0])) {
5864
      return $haystack;
5865
    }
5866
5867
    if (self::str_istarts_with($haystack, $needle) === true) {
5868
      $haystack = self::substr($haystack, self::strlen($needle));
5869
    }
5870
5871
    return $haystack;
5872
  }
5873
5874
  /**
@@ 5882-5900 (lines=19) @@
5879
   *
5880
   * @return string <p>Return the sub-string.</p>
5881
   */
5882
  public static function substr_iright($haystack, $needle)
5883
  {
5884
    // init
5885
    $haystack = (string)$haystack;
5886
    $needle = (string)$needle;
5887
5888
    if (!isset($haystack[0])) {
5889
      return '';
5890
    }
5891
5892
    if (!isset($needle[0])) {
5893
      return $haystack;
5894
    }
5895
5896
    if (self::str_iends_with($haystack, $needle) === true) {
5897
      $haystack = self::substr($haystack, 0, self::strlen($haystack) - self::strlen($needle));
5898
    }
5899
5900
    return $haystack;
5901
  }
5902
5903
  /**
@@ 5911-5929 (lines=19) @@
5908
   *
5909
   * @return string <p>Return the sub-string.</p>
5910
   */
5911
  public static function substr_left($haystack, $needle)
5912
  {
5913
    // init
5914
    $haystack = (string)$haystack;
5915
    $needle = (string)$needle;
5916
5917
    if (!isset($haystack[0])) {
5918
      return '';
5919
    }
5920
5921
    if (!isset($needle[0])) {
5922
      return $haystack;
5923
    }
5924
5925
    if (self::str_starts_with($haystack, $needle) === true) {
5926
      $haystack = self::substr($haystack, self::strlen($needle));
5927
    }
5928
5929
    return $haystack;
5930
  }
5931
5932
  /**
@@ 6038-6056 (lines=19) @@
6035
   *
6036
   * @return string <p>Return the sub-string.</p>
6037
   */
6038
  public static function substr_right($haystack, $needle)
6039
  {
6040
    $haystack = (string)$haystack;
6041
    $needle = (string)$needle;
6042
6043
    if (!isset($haystack[0])) {
6044
      return '';
6045
    }
6046
6047
    if (!isset($needle[0])) {
6048
      return $haystack;
6049
    }
6050
6051
    if (self::str_ends_with($haystack, $needle) === true) {
6052
      $haystack = self::substr($haystack, 0, self::strlen($haystack) - self::strlen($needle));
6053
    }
6054
6055
    return $haystack;
6056
  }
6057
6058
  /**
6059
   * Returns a case swapped version of the string.