Code Duplication    Length = 7-7 lines in 4 locations

src/Stringy.php 4 locations

@@ 2010-2016 (lines=7) @@
2007
     *
2008
     * @return static
2009
     */
2010
    public function lastSubstringOf(string $needle, bool $beforeNeedle = false): self
2011
    {
2012
        return static::create(
2013
            $this->utf8::str_substr_last(
2014
                $this->str,
2015
                $needle,
2016
                $beforeNeedle,
2017
                $this->encoding
2018
            ),
2019
            $this->encoding
@@ 2034-2040 (lines=7) @@
2031
     *
2032
     * @return static
2033
     */
2034
    public function lastSubstringOfIgnoreCase(string $needle, bool $beforeNeedle = false): self
2035
    {
2036
        return static::create(
2037
            $this->utf8::str_isubstr_last(
2038
                $this->str,
2039
                $needle,
2040
                $beforeNeedle,
2041
                $this->encoding
2042
            ),
2043
            $this->encoding
@@ 3261-3267 (lines=7) @@
3258
     *
3259
     * @return static
3260
     */
3261
    public function substringOf(string $needle, bool $beforeNeedle = false): self
3262
    {
3263
        return static::create(
3264
            $this->utf8::str_substr_first(
3265
                $this->str,
3266
                $needle,
3267
                $beforeNeedle,
3268
                $this->encoding
3269
            ),
3270
            $this->encoding
@@ 3285-3291 (lines=7) @@
3282
     *
3283
     * @return static
3284
     */
3285
    public function substringOfIgnoreCase(string $needle, bool $beforeNeedle = false): self
3286
    {
3287
        return static::create(
3288
            $this->utf8::str_isubstr_first(
3289
                $this->str,
3290
                $needle,
3291
                $beforeNeedle,
3292
                $this->encoding
3293
            ),
3294
            $this->encoding