Code Duplication    Length = 12-14 lines in 2 locations

src/Stringy.php 2 locations

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