Code Duplication    Length = 7-7 lines in 4 locations

src/Stringy.php 4 locations

@@ 2015-2021 (lines=7) @@
2012
     *
2013
     * @return static
2014
     */
2015
    public function lastSubstringOf(string $needle, bool $beforeNeedle = false): self
2016
    {
2017
        return static::create(
2018
            $this->utf8::str_substr_last(
2019
                $this->str,
2020
                $needle,
2021
                $beforeNeedle,
2022
                $this->encoding
2023
            ),
2024
            $this->encoding
@@ 2039-2045 (lines=7) @@
2036
     *
2037
     * @return static
2038
     */
2039
    public function lastSubstringOfIgnoreCase(string $needle, bool $beforeNeedle = false): self
2040
    {
2041
        return static::create(
2042
            $this->utf8::str_isubstr_last(
2043
                $this->str,
2044
                $needle,
2045
                $beforeNeedle,
2046
                $this->encoding
2047
            ),
2048
            $this->encoding
@@ 3334-3340 (lines=7) @@
3331
     *
3332
     * @return static
3333
     */
3334
    public function substringOf(string $needle, bool $beforeNeedle = false): self
3335
    {
3336
        return static::create(
3337
            $this->utf8::str_substr_first(
3338
                $this->str,
3339
                $needle,
3340
                $beforeNeedle,
3341
                $this->encoding
3342
            ),
3343
            $this->encoding
@@ 3358-3364 (lines=7) @@
3355
     *
3356
     * @return static
3357
     */
3358
    public function substringOfIgnoreCase(string $needle, bool $beforeNeedle = false): self
3359
    {
3360
        return static::create(
3361
            $this->utf8::str_isubstr_first(
3362
                $this->str,
3363
                $needle,
3364
                $beforeNeedle,
3365
                $this->encoding
3366
            ),
3367
            $this->encoding