Code Duplication    Length = 12-14 lines in 2 locations

src/Stringy.php 2 locations

@@ 865-878 (lines=14) @@
862
   *
863
   * @return static <p>Object with the first character of $str being upper case.</p>
864
   */
865
  public function upperCaseFirst()
866
  {
867
    $first = UTF8::substr($this->str, 0, 1, $this->encoding);
868
    $rest = UTF8::substr(
869
        $this->str,
870
        1,
871
        $this->length() - 1,
872
        $this->encoding
873
    );
874
875
    $str = UTF8::strtoupper($first, $this->encoding) . $rest;
876
877
    return static::create($str, $this->encoding);
878
  }
879
880
  /**
881
   * Returns the index of the last occurrence of $needle in the string,
@@ 2479-2490 (lines=12) @@
2476
   *
2477
   * @return static  Object with the first character of $str being lower case
2478
   */
2479
  public function lowerCaseFirst()
2480
  {
2481
    $first = UTF8::substr($this->str, 0, 1, $this->encoding);
2482
    $rest = UTF8::substr($this->str, 1, $this->length() - 1, $this->encoding);
2483
2484
    $str = UTF8::strtolower($first, $this->encoding) . $rest;
2485
2486
    return static::create($str, $this->encoding);
2487
  }
2488
2489
  /**
2490
   * Shorten the string after $length, but also after the next word.
2491
   *
2492
   * @param int    $length
2493
   * @param string $strAddOn [optional] <p>Default: '...'</p>