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,
@@ 2004-2015 (lines=12) @@
2001
   *
2002
   * @return Stringy Object with the first character of $str being lower case
2003
   */
2004
  public function lowerCaseFirst()
2005
  {
2006
    $first = UTF8::substr($this->str, 0, 1, $this->encoding);
2007
    $rest = UTF8::substr(
2008
        $this->str, 1, $this->length() - 1,
2009
        $this->encoding
2010
    );
2011
2012
    $str = UTF8::strtolower($first, $this->encoding) . $rest;
2013
2014
    return static::create($str, $this->encoding);
2015
  }
2016
2017
  /**
2018
   * Shorten the string after $length, but also after the next word.