Code Duplication    Length = 19-19 lines in 4 locations

src/voku/helper/UTF8.php 4 locations

@@ 6035-6053 (lines=19) @@
6032
   *
6033
   * @return string <p>Return the sub-string.</p>
6034
   */
6035
  public static function substr_ileft($haystack, $needle)
6036
  {
6037
    // init
6038
    $haystack = (string)$haystack;
6039
    $needle = (string)$needle;
6040
6041
    if (!isset($haystack[0])) {
6042
      return '';
6043
    }
6044
6045
    if (!isset($needle[0])) {
6046
      return $haystack;
6047
    }
6048
6049
    if (self::str_istarts_with($haystack, $needle) === true) {
6050
      $haystack = self::substr($haystack, self::strlen($needle));
6051
    }
6052
6053
    return $haystack;
6054
  }
6055
6056
  /**
@@ 6064-6082 (lines=19) @@
6061
   *
6062
   * @return string <p>Return the sub-string.</p>
6063
   */
6064
  public static function substr_iright($haystack, $needle)
6065
  {
6066
    // init
6067
    $haystack = (string)$haystack;
6068
    $needle = (string)$needle;
6069
6070
    if (!isset($haystack[0])) {
6071
      return '';
6072
    }
6073
6074
    if (!isset($needle[0])) {
6075
      return $haystack;
6076
    }
6077
6078
    if (self::str_iends_with($haystack, $needle) === true) {
6079
      $haystack = self::substr($haystack, 0, self::strlen($haystack) - self::strlen($needle));
6080
    }
6081
6082
    return $haystack;
6083
  }
6084
6085
  /**
@@ 6093-6111 (lines=19) @@
6090
   *
6091
   * @return string <p>Return the sub-string.</p>
6092
   */
6093
  public static function substr_left($haystack, $needle)
6094
  {
6095
    // init
6096
    $haystack = (string)$haystack;
6097
    $needle = (string)$needle;
6098
6099
    if (!isset($haystack[0])) {
6100
      return '';
6101
    }
6102
6103
    if (!isset($needle[0])) {
6104
      return $haystack;
6105
    }
6106
6107
    if (self::str_starts_with($haystack, $needle) === true) {
6108
      $haystack = self::substr($haystack, self::strlen($needle));
6109
    }
6110
6111
    return $haystack;
6112
  }
6113
6114
  /**
@@ 6220-6238 (lines=19) @@
6217
   *
6218
   * @return string <p>Return the sub-string.</p>
6219
   */
6220
  public static function substr_right($haystack, $needle)
6221
  {
6222
    $haystack = (string)$haystack;
6223
    $needle = (string)$needle;
6224
6225
    if (!isset($haystack[0])) {
6226
      return '';
6227
    }
6228
6229
    if (!isset($needle[0])) {
6230
      return $haystack;
6231
    }
6232
6233
    if (self::str_ends_with($haystack, $needle) === true) {
6234
      $haystack = self::substr($haystack, 0, self::strlen($haystack) - self::strlen($needle));
6235
    }
6236
6237
    return $haystack;
6238
  }
6239
6240
  /**
6241
   * Returns a case swapped version of the string.