Code Duplication    Length = 9-14 lines in 2 locations

src/Stringy.php 2 locations

@@ 866-879 (lines=14) @@
863
   *
864
   * @return static <p>Object with the first character of $str being upper case.</p>
865
   */
866
  public function upperCaseFirst(): self
867
  {
868
    $first = UTF8::substr($this->str, 0, 1, $this->encoding);
869
    $rest = UTF8::substr(
870
        $this->str,
871
        1,
872
        $this->length() - 1,
873
        $this->encoding
874
    );
875
876
    $str = UTF8::strtoupper($first, $this->encoding) . $rest;
877
878
    return static::create($str, $this->encoding);
879
  }
880
881
  /**
882
   * Returns the index of the last occurrence of $needle in the string,
@@ 2620-2628 (lines=9) @@
2617
   *
2618
   * @return static <p>Object with the first character of $str being lower case.</p>
2619
   */
2620
  public function lowerCaseFirst(): self
2621
  {
2622
    $first = UTF8::substr($this->str, 0, 1, $this->encoding);
2623
    $rest = UTF8::substr($this->str, 1, $this->length() - 1, $this->encoding);
2624
2625
    $str = UTF8::strtolower($first, $this->encoding) . $rest;
2626
2627
    return static::create($str, $this->encoding);
2628
  }
2629
2630
  /**
2631
   * Shorten the string after $length, but also after the next word.