Code Duplication    Length = 12-14 lines in 2 locations

src/Stringy.php 2 locations

@@ 700-713 (lines=14) @@
697
   *
698
   * @return Stringy Object with the first character of $str being upper case
699
   */
700
  public function upperCaseFirst()
701
  {
702
    $first = UTF8::substr($this->str, 0, 1, $this->encoding);
703
    $rest = UTF8::substr(
704
        $this->str,
705
        1,
706
        $this->length() - 1,
707
        $this->encoding
708
    );
709
710
    $str = UTF8::strtoupper($first, $this->encoding) . $rest;
711
712
    return static::create($str, $this->encoding);
713
  }
714
715
  /**
716
   * Returns the index of the last occurrence of $needle in the string,
@@ 2169-2180 (lines=12) @@
2166
   *
2167
   * @return Stringy Object with the first character of $str being lower case
2168
   */
2169
  public function lowerCaseFirst()
2170
  {
2171
    $first = UTF8::substr($this->str, 0, 1, $this->encoding);
2172
    $rest = UTF8::substr($this->str, 1, $this->length() - 1, $this->encoding);
2173
2174
    $str = UTF8::strtolower($first, $this->encoding) . $rest;
2175
2176
    return static::create($str, $this->encoding);
2177
  }
2178
2179
  /**
2180
   * Shorten the string after $length, but also after the next word.
2181
   *
2182
   * @param int    $length
2183
   * @param string $strAddOn