Code Duplication    Length = 12-14 lines in 2 locations

src/Stringy.php 2 locations

@@ 756-769 (lines=14) @@
753
   *
754
   * @return static  Object with the first character of $str being upper case
755
   */
756
  public function upperCaseFirst()
757
  {
758
    $first = UTF8::substr($this->str, 0, 1, $this->encoding);
759
    $rest = UTF8::substr(
760
        $this->str,
761
        1,
762
        $this->length() - 1,
763
        $this->encoding
764
    );
765
766
    $str = UTF8::strtoupper($first, $this->encoding) . $rest;
767
768
    return static::create($str, $this->encoding);
769
  }
770
771
  /**
772
   * Returns the index of the last occurrence of $needle in the string,
@@ 2265-2276 (lines=12) @@
2262
   *
2263
   * @return static  Object with the first character of $str being lower case
2264
   */
2265
  public function lowerCaseFirst()
2266
  {
2267
    $first = UTF8::substr($this->str, 0, 1, $this->encoding);
2268
    $rest = UTF8::substr($this->str, 1, $this->length() - 1, $this->encoding);
2269
2270
    $str = UTF8::strtolower($first, $this->encoding) . $rest;
2271
2272
    return static::create($str, $this->encoding);
2273
  }
2274
2275
  /**
2276
   * Shorten the string after $length, but also after the next word.
2277
   *
2278
   * @param int    $length
2279
   * @param string $strAddOn