Code Duplication    Length = 12-14 lines in 2 locations

src/Stringy.php 2 locations

@@ 702-715 (lines=14) @@
699
   *
700
   * @return Stringy Object with the first character of $str being upper case
701
   */
702
  public function upperCaseFirst()
703
  {
704
    $first = UTF8::substr($this->str, 0, 1, $this->encoding);
705
    $rest = UTF8::substr(
706
        $this->str,
707
        1,
708
        $this->length() - 1,
709
        $this->encoding
710
    );
711
712
    $str = UTF8::strtoupper($first, $this->encoding) . $rest;
713
714
    return static::create($str, $this->encoding);
715
  }
716
717
  /**
718
   * Returns the index of the last occurrence of $needle in the string,
@@ 2014-2025 (lines=12) @@
2011
   *
2012
   * @return Stringy Object with the first character of $str being lower case
2013
   */
2014
  public function lowerCaseFirst()
2015
  {
2016
    $first = UTF8::substr($this->str, 0, 1, $this->encoding);
2017
    $rest = UTF8::substr(
2018
        $this->str, 1, $this->length() - 1,
2019
        $this->encoding
2020
    );
2021
2022
    $str = UTF8::strtolower($first, $this->encoding) . $rest;
2023
2024
    return static::create($str, $this->encoding);
2025
  }
2026
2027
  /**
2028
   * Shorten the string after $length, but also after the next word.