Code Duplication    Length = 12-14 lines in 2 locations

src/Stringy.php 2 locations

@@ 698-711 (lines=14) @@
695
   *
696
   * @return Stringy Object with the first character of $str being upper case
697
   */
698
  public function upperCaseFirst()
699
  {
700
    $first = UTF8::substr($this->str, 0, 1, $this->encoding);
701
    $rest = UTF8::substr(
702
        $this->str,
703
        1,
704
        $this->length() - 1,
705
        $this->encoding
706
    );
707
708
    $str = UTF8::strtoupper($first, $this->encoding) . $rest;
709
710
    return static::create($str, $this->encoding);
711
  }
712
713
  /**
714
   * Returns the index of the last occurrence of $needle in the string,
@@ 2152-2163 (lines=12) @@
2149
   *
2150
   * @return Stringy Object with the first character of $str being lower case
2151
   */
2152
  public function lowerCaseFirst()
2153
  {
2154
    $first = UTF8::substr($this->str, 0, 1, $this->encoding);
2155
    $rest = UTF8::substr($this->str, 1, $this->length() - 1, $this->encoding);
2156
2157
    $str = UTF8::strtolower($first, $this->encoding) . $rest;
2158
2159
    return static::create($str, $this->encoding);
2160
  }
2161
2162
  /**
2163
   * Shorten the string after $length, but also after the next word.
2164
   *
2165
   * @param int    $length
2166
   * @param string $strAddOn