Code Duplication    Length = 12-14 lines in 2 locations

src/Stringy.php 2 locations

@@ 750-763 (lines=14) @@
747
   *
748
   * @return static  Object with the first character of $str being upper case
749
   */
750
  public function upperCaseFirst()
751
  {
752
    $first = UTF8::substr($this->str, 0, 1, $this->encoding);
753
    $rest = UTF8::substr(
754
        $this->str,
755
        1,
756
        $this->length() - 1,
757
        $this->encoding
758
    );
759
760
    $str = UTF8::strtoupper($first, $this->encoding) . $rest;
761
762
    return static::create($str, $this->encoding);
763
  }
764
765
  /**
766
   * Returns the index of the last occurrence of $needle in the string,
@@ 2258-2269 (lines=12) @@
2255
   *
2256
   * @return static  Object with the first character of $str being lower case
2257
   */
2258
  public function lowerCaseFirst()
2259
  {
2260
    $first = UTF8::substr($this->str, 0, 1, $this->encoding);
2261
    $rest = UTF8::substr($this->str, 1, $this->length() - 1, $this->encoding);
2262
2263
    $str = UTF8::strtolower($first, $this->encoding) . $rest;
2264
2265
    return static::create($str, $this->encoding);
2266
  }
2267
2268
  /**
2269
   * Shorten the string after $length, but also after the next word.
2270
   *
2271
   * @param int    $length
2272
   * @param string $strAddOn