Code Duplication    Length = 7-7 lines in 4 locations

src/Stringy.php 4 locations

@@ 1134-1140 (lines=7) @@
1131
     *
1132
     * @return static
1133
     */
1134
    public function lastSubstringOf(string $needle, bool $beforeNeedle = false): self
1135
    {
1136
        return static::create(
1137
            $this->utf8::str_substr_last($this->str, $needle, $beforeNeedle, $this->encoding),
1138
            $this->encoding
1139
        );
1140
    }
1141
1142
    /**
1143
     * Gets the substring after (or before via "$beforeNeedle") the last occurrence of the "$needle".
@@ 1151-1157 (lines=7) @@
1148
     *
1149
     * @return static
1150
     */
1151
    public function lastSubstringOfIgnoreCase(string $needle, bool $beforeNeedle = false): self
1152
    {
1153
        return static::create(
1154
            $this->utf8::str_isubstr_last($this->str, $needle, $beforeNeedle, $this->encoding),
1155
            $this->encoding
1156
        );
1157
    }
1158
1159
    /**
1160
     * Returns the length of the string.
@@ 1987-1993 (lines=7) @@
1984
     *
1985
     * @return static
1986
     */
1987
    public function substringOf(string $needle, bool $beforeNeedle = false): self
1988
    {
1989
        return static::create(
1990
            $this->utf8::str_substr_first($this->str, $needle, $beforeNeedle, $this->encoding),
1991
            $this->encoding
1992
        );
1993
    }
1994
1995
    /**
1996
     * Gets the substring after (or before via "$beforeNeedle") the first occurrence of the "$needle".
@@ 2004-2010 (lines=7) @@
2001
     *
2002
     * @return static
2003
     */
2004
    public function substringOfIgnoreCase(string $needle, bool $beforeNeedle = false): self
2005
    {
2006
        return static::create(
2007
            $this->utf8::str_isubstr_first($this->str, $needle, $beforeNeedle, $this->encoding),
2008
            $this->encoding
2009
        );
2010
    }
2011
2012
    /**
2013
     * Surrounds $str with the given substring.