Code Duplication    Length = 9-14 lines in 2 locations

src/Stringy.php 2 locations

@@ 863-876 (lines=14) @@
860
   *
861
   * @return static <p>Object with the first character of $str being upper case.</p>
862
   */
863
  public function upperCaseFirst(): Stringy
864
  {
865
    $first = UTF8::substr($this->str, 0, 1, $this->encoding);
866
    $rest = UTF8::substr(
867
        $this->str,
868
        1,
869
        $this->length() - 1,
870
        $this->encoding
871
    );
872
873
    $str = UTF8::strtoupper($first, $this->encoding) . $rest;
874
875
    return static::create($str, $this->encoding);
876
  }
877
878
  /**
879
   * Returns the index of the last occurrence of $needle in the string,
@@ 2473-2481 (lines=9) @@
2470
   *
2471
   * @return static <p>Object with the first character of $str being lower case.</p>
2472
   */
2473
  public function lowerCaseFirst(): Stringy
2474
  {
2475
    $first = UTF8::substr($this->str, 0, 1, $this->encoding);
2476
    $rest = UTF8::substr($this->str, 1, $this->length() - 1, $this->encoding);
2477
2478
    $str = UTF8::strtolower($first, $this->encoding) . $rest;
2479
2480
    return static::create($str, $this->encoding);
2481
  }
2482
2483
  /**
2484
   * Shorten the string after $length, but also after the next word.