Code Duplication    Length = 19-19 lines in 4 locations

src/voku/helper/UTF8.php 4 locations

@@ 6126-6144 (lines=19) @@
6123
   *
6124
   * @return string <p>Return the sub-string.</p>
6125
   */
6126
  public static function substr_ileft($haystack, $needle)
6127
  {
6128
    // init
6129
    $haystack = (string)$haystack;
6130
    $needle = (string)$needle;
6131
6132
    if (!isset($haystack[0])) {
6133
      return '';
6134
    }
6135
6136
    if (!isset($needle[0])) {
6137
      return $haystack;
6138
    }
6139
6140
    if (self::str_istarts_with($haystack, $needle) === true) {
6141
      $haystack = self::substr($haystack, self::strlen($needle));
6142
    }
6143
6144
    return $haystack;
6145
  }
6146
6147
  /**
@@ 6155-6173 (lines=19) @@
6152
   *
6153
   * @return string <p>Return the sub-string.</p>
6154
   */
6155
  public static function substr_iright($haystack, $needle)
6156
  {
6157
    // init
6158
    $haystack = (string)$haystack;
6159
    $needle = (string)$needle;
6160
6161
    if (!isset($haystack[0])) {
6162
      return '';
6163
    }
6164
6165
    if (!isset($needle[0])) {
6166
      return $haystack;
6167
    }
6168
6169
    if (self::str_iends_with($haystack, $needle) === true) {
6170
      $haystack = self::substr($haystack, 0, self::strlen($haystack) - self::strlen($needle));
6171
    }
6172
6173
    return $haystack;
6174
  }
6175
6176
  /**
@@ 6184-6202 (lines=19) @@
6181
   *
6182
   * @return string <p>Return the sub-string.</p>
6183
   */
6184
  public static function substr_left($haystack, $needle)
6185
  {
6186
    // init
6187
    $haystack = (string)$haystack;
6188
    $needle = (string)$needle;
6189
6190
    if (!isset($haystack[0])) {
6191
      return '';
6192
    }
6193
6194
    if (!isset($needle[0])) {
6195
      return $haystack;
6196
    }
6197
6198
    if (self::str_starts_with($haystack, $needle) === true) {
6199
      $haystack = self::substr($haystack, self::strlen($needle));
6200
    }
6201
6202
    return $haystack;
6203
  }
6204
6205
  /**
@@ 6311-6329 (lines=19) @@
6308
   *
6309
   * @return string <p>Return the sub-string.</p>
6310
   */
6311
  public static function substr_right($haystack, $needle)
6312
  {
6313
    $haystack = (string)$haystack;
6314
    $needle = (string)$needle;
6315
6316
    if (!isset($haystack[0])) {
6317
      return '';
6318
    }
6319
6320
    if (!isset($needle[0])) {
6321
      return $haystack;
6322
    }
6323
6324
    if (self::str_ends_with($haystack, $needle) === true) {
6325
      $haystack = self::substr($haystack, 0, self::strlen($haystack) - self::strlen($needle));
6326
    }
6327
6328
    return $haystack;
6329
  }
6330
6331
  /**
6332
   * Returns a case swapped version of the string.