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,
@@ 1828-1839 (lines=12) @@
1825
   *
1826
   * @return Stringy Object with the first character of $str being lower case
1827
   */
1828
  public function lowerCaseFirst()
1829
  {
1830
    $first = UTF8::substr($this->str, 0, 1, $this->encoding);
1831
    $rest = UTF8::substr(
1832
        $this->str, 1, $this->length() - 1,
1833
        $this->encoding
1834
    );
1835
1836
    $str = UTF8::strtolower($first, $this->encoding) . $rest;
1837
1838
    return static::create($str, $this->encoding);
1839
  }
1840
}
1841