Code Duplication    Length = 12-14 lines in 2 locations

src/Stringy.php 2 locations

@@ 725-738 (lines=14) @@
722
   *
723
   * @return Stringy Object with the first character of $str being upper case
724
   */
725
  public function upperCaseFirst()
726
  {
727
    $first = UTF8::substr($this->str, 0, 1, $this->encoding);
728
    $rest = UTF8::substr(
729
        $this->str,
730
        1,
731
        $this->length() - 1,
732
        $this->encoding
733
    );
734
735
    $str = UTF8::strtoupper($first, $this->encoding) . $rest;
736
737
    return static::create($str, $this->encoding);
738
  }
739
740
  /**
741
   * Returns the index of the last occurrence of $needle in the string,
@@ 2198-2209 (lines=12) @@
2195
   *
2196
   * @return Stringy Object with the first character of $str being lower case
2197
   */
2198
  public function lowerCaseFirst()
2199
  {
2200
    $first = UTF8::substr($this->str, 0, 1, $this->encoding);
2201
    $rest = UTF8::substr($this->str, 1, $this->length() - 1, $this->encoding);
2202
2203
    $str = UTF8::strtolower($first, $this->encoding) . $rest;
2204
2205
    return static::create($str, $this->encoding);
2206
  }
2207
2208
  /**
2209
   * Shorten the string after $length, but also after the next word.
2210
   *
2211
   * @param int    $length
2212
   * @param string $strAddOn