Code Duplication    Length = 19-19 lines in 4 locations

src/voku/helper/UTF8.php 4 locations

@@ 5681-5699 (lines=19) @@
5678
   *
5679
   * @return string <p>Return the sub-string.</p>
5680
   */
5681
  public static function substr_ileft($haystack, $needle)
5682
  {
5683
    $haystack = (string)$haystack;
5684
    $needle = (string)$needle;
5685
5686
    if (!isset($haystack[0])) {
5687
      return '';
5688
    }
5689
5690
    if (!isset($needle[0])) {
5691
      return $haystack;
5692
    }
5693
5694
    if (self::str_istarts_with($haystack, $needle) === true) {
5695
      $haystack = self::substr($haystack, self::strlen($needle));
5696
    }
5697
5698
    return $haystack;
5699
  }
5700
5701
  /**
5702
   * Removes an suffix ($needle) from end of the string ($haystack), case insensitive.
@@ 5709-5727 (lines=19) @@
5706
   *
5707
   * @return string <p>Return the sub-string.</p>
5708
   */
5709
  public static function substr_iright($haystack, $needle)
5710
  {
5711
    $haystack = (string)$haystack;
5712
    $needle = (string)$needle;
5713
5714
    if (!isset($haystack[0])) {
5715
      return '';
5716
    }
5717
5718
    if (!isset($needle[0])) {
5719
      return $haystack;
5720
    }
5721
5722
    if (self::str_iends_with($haystack, $needle) === true) {
5723
      $haystack = self::substr($haystack, 0, self::strlen($haystack) - self::strlen($needle));
5724
    }
5725
5726
    return $haystack;
5727
  }
5728
5729
  /**
5730
   * Removes an prefix ($needle) from start of the string ($haystack).
@@ 5737-5755 (lines=19) @@
5734
   *
5735
   * @return string <p>Return the sub-string.</p>
5736
   */
5737
  public static function substr_left($haystack, $needle)
5738
  {
5739
    $haystack = (string)$haystack;
5740
    $needle = (string)$needle;
5741
5742
    if (!isset($haystack[0])) {
5743
      return '';
5744
    }
5745
5746
    if (!isset($needle[0])) {
5747
      return $haystack;
5748
    }
5749
5750
    if (self::str_starts_with($haystack, $needle) === true) {
5751
      $haystack = self::substr($haystack, self::strlen($needle));
5752
    }
5753
5754
    return $haystack;
5755
  }
5756
5757
  /**
5758
   * Replace text within a portion of a string.
@@ 5841-5859 (lines=19) @@
5838
   *
5839
   * @return string <p>Return the sub-string.</p>
5840
   */
5841
  public static function substr_right($haystack, $needle)
5842
  {
5843
    $haystack = (string)$haystack;
5844
    $needle = (string)$needle;
5845
5846
    if (!isset($haystack[0])) {
5847
      return '';
5848
    }
5849
5850
    if (!isset($needle[0])) {
5851
      return $haystack;
5852
    }
5853
5854
    if (self::str_ends_with($haystack, $needle) === true) {
5855
      $haystack = self::substr($haystack, 0, self::strlen($haystack) - self::strlen($needle));
5856
    }
5857
5858
    return $haystack;
5859
  }
5860
5861
  /**
5862
   * Returns a case swapped version of the string.