Code Duplication    Length = 7-7 lines in 4 locations

src/Stringy.php 4 locations

@@ 2426-2432 (lines=7) @@
2423
     *
2424
     * @return static
2425
     */
2426
    public function lastSubstringOf(string $needle, bool $beforeNeedle = false): self
2427
    {
2428
        return static::create(
2429
            $this->utf8::str_substr_last(
2430
                $this->str,
2431
                $needle,
2432
                $beforeNeedle,
2433
                $this->encoding
2434
            ),
2435
            $this->encoding
@@ 2453-2459 (lines=7) @@
2450
     *
2451
     * @return static
2452
     */
2453
    public function lastSubstringOfIgnoreCase(string $needle, bool $beforeNeedle = false): self
2454
    {
2455
        return static::create(
2456
            $this->utf8::str_isubstr_last(
2457
                $this->str,
2458
                $needle,
2459
                $beforeNeedle,
2460
                $this->encoding
2461
            ),
2462
            $this->encoding
@@ 4040-4046 (lines=7) @@
4037
     *
4038
     * @return static
4039
     */
4040
    public function substringOf(string $needle, bool $beforeNeedle = false): self
4041
    {
4042
        return static::create(
4043
            $this->utf8::str_substr_first(
4044
                $this->str,
4045
                $needle,
4046
                $beforeNeedle,
4047
                $this->encoding
4048
            ),
4049
            $this->encoding
@@ 4067-4073 (lines=7) @@
4064
     *
4065
     * @return static
4066
     */
4067
    public function substringOfIgnoreCase(string $needle, bool $beforeNeedle = false): self
4068
    {
4069
        return static::create(
4070
            $this->utf8::str_isubstr_first(
4071
                $this->str,
4072
                $needle,
4073
                $beforeNeedle,
4074
                $this->encoding
4075
            ),
4076
            $this->encoding