Code Duplication    Length = 12-14 lines in 2 locations

src/Stringy.php 2 locations

@@ 725-738 (lines=14) @@
722
   *
723
   * @return Stringy Object with the first character of $str being upper case
724
   */
725
  public function upperCaseFirst()
726
  {
727
    $first = UTF8::substr($this->str, 0, 1, $this->encoding);
728
    $rest = UTF8::substr(
729
        $this->str,
730
        1,
731
        $this->length() - 1,
732
        $this->encoding
733
    );
734
735
    $str = UTF8::strtoupper($first, $this->encoding) . $rest;
736
737
    return static::create($str, $this->encoding);
738
  }
739
740
  /**
741
   * Returns the index of the last occurrence of $needle in the string,
@@ 2222-2233 (lines=12) @@
2219
   *
2220
   * @return Stringy Object with the first character of $str being lower case
2221
   */
2222
  public function lowerCaseFirst()
2223
  {
2224
    $first = UTF8::substr($this->str, 0, 1, $this->encoding);
2225
    $rest = UTF8::substr($this->str, 1, $this->length() - 1, $this->encoding);
2226
2227
    $str = UTF8::strtolower($first, $this->encoding) . $rest;
2228
2229
    return static::create($str, $this->encoding);
2230
  }
2231
2232
  /**
2233
   * Shorten the string after $length, but also after the next word.
2234
   *
2235
   * @param int    $length
2236
   * @param string $strAddOn