Code Duplication    Length = 12-14 lines in 2 locations

src/Stringy.php 2 locations

@@ 772-785 (lines=14) @@
769
   *
770
   * @return static  Object with the first character of $str being upper case
771
   */
772
  public function upperCaseFirst()
773
  {
774
    $first = UTF8::substr($this->str, 0, 1, $this->encoding);
775
    $rest = UTF8::substr(
776
        $this->str,
777
        1,
778
        $this->length() - 1,
779
        $this->encoding
780
    );
781
782
    $str = UTF8::strtoupper($first, $this->encoding) . $rest;
783
784
    return static::create($str, $this->encoding);
785
  }
786
787
  /**
788
   * Returns the index of the last occurrence of $needle in the string,
@@ 2385-2396 (lines=12) @@
2382
   *
2383
   * @return static  Object with the first character of $str being lower case
2384
   */
2385
  public function lowerCaseFirst()
2386
  {
2387
    $first = UTF8::substr($this->str, 0, 1, $this->encoding);
2388
    $rest = UTF8::substr($this->str, 1, $this->length() - 1, $this->encoding);
2389
2390
    $str = UTF8::strtolower($first, $this->encoding) . $rest;
2391
2392
    return static::create($str, $this->encoding);
2393
  }
2394
2395
  /**
2396
   * Shorten the string after $length, but also after the next word.
2397
   *
2398
   * @param int    $length
2399
   * @param string $strAddOn