Code Duplication    Length = 12-14 lines in 2 locations

src/Stringy.php 2 locations

@@ 641-654 (lines=14) @@
638
   *
639
   * @return Stringy Object with the first character of $str being upper case
640
   */
641
  public function upperCaseFirst()
642
  {
643
    $first = UTF8::substr($this->str, 0, 1, $this->encoding);
644
    $rest = UTF8::substr(
645
        $this->str,
646
        1,
647
        $this->length() - 1,
648
        $this->encoding
649
    );
650
651
    $str = UTF8::strtoupper($first, $this->encoding) . $rest;
652
653
    return static::create($str, $this->encoding);
654
  }
655
656
  /**
657
   * Returns the index of the last occurrence of $needle in the string,
@@ 1878-1889 (lines=12) @@
1875
   *
1876
   * @return Stringy Object with the first character of $str being lower case
1877
   */
1878
  public function lowerCaseFirst()
1879
  {
1880
    $first = UTF8::substr($this->str, 0, 1, $this->encoding);
1881
    $rest = UTF8::substr(
1882
        $this->str, 1, $this->length() - 1,
1883
        $this->encoding
1884
    );
1885
1886
    $str = UTF8::strtolower($first, $this->encoding) . $rest;
1887
1888
    return static::create($str, $this->encoding);
1889
  }
1890
}
1891