Code Duplication    Length = 7-7 lines in 4 locations

src/Stringy.php 4 locations

@@ 1185-1191 (lines=7) @@
1182
     *
1183
     * @return static
1184
     */
1185
    public function lastSubstringOf(string $needle, bool $beforeNeedle = false): self
1186
    {
1187
        return static::create(
1188
            $this->utf8::str_substr_last($this->str, $needle, $beforeNeedle, $this->encoding),
1189
            $this->encoding
1190
        );
1191
    }
1192
1193
    /**
1194
     * Gets the substring after (or before via "$beforeNeedle") the last occurrence of the "$needle".
@@ 1202-1208 (lines=7) @@
1199
     *
1200
     * @return static
1201
     */
1202
    public function lastSubstringOfIgnoreCase(string $needle, bool $beforeNeedle = false): self
1203
    {
1204
        return static::create(
1205
            $this->utf8::str_isubstr_last($this->str, $needle, $beforeNeedle, $this->encoding),
1206
            $this->encoding
1207
        );
1208
    }
1209
1210
    /**
1211
     * Returns the length of the string.
@@ 2067-2073 (lines=7) @@
2064
     *
2065
     * @return static
2066
     */
2067
    public function substringOf(string $needle, bool $beforeNeedle = false): self
2068
    {
2069
        return static::create(
2070
            $this->utf8::str_substr_first($this->str, $needle, $beforeNeedle, $this->encoding),
2071
            $this->encoding
2072
        );
2073
    }
2074
2075
    /**
2076
     * Gets the substring after (or before via "$beforeNeedle") the first occurrence of the "$needle".
@@ 2084-2090 (lines=7) @@
2081
     *
2082
     * @return static
2083
     */
2084
    public function substringOfIgnoreCase(string $needle, bool $beforeNeedle = false): self
2085
    {
2086
        return static::create(
2087
            $this->utf8::str_isubstr_first($this->str, $needle, $beforeNeedle, $this->encoding),
2088
            $this->encoding
2089
        );
2090
    }
2091
2092
    /**
2093
     * Surrounds $str with the given substring.