Code Duplication    Length = 16-16 lines in 2 locations

src/macros.php 2 locations

@@ 30-45 (lines=16) @@
27
    });
28
}
29
30
if (! Collection::hasMacro('ifEmpty')) {
31
    /*
32
     * Execute a callable if the collection is empty, then return the collection.
33
     *
34
     * @param callable $callback
35
     *
36
     * @return \Illuminate\Support\Collection
37
     */
38
    Collection::macro('ifEmpty', function (callable $callback): Collection {
39
        if ($this->isEmpty()) {
40
            $callback($this);
41
        }
42
43
        return $this;
44
    });
45
}
46
47
if (! Collection::hasMacro('ifAny')) {
48
    /*
@@ 47-62 (lines=16) @@
44
    });
45
}
46
47
if (! Collection::hasMacro('ifAny')) {
48
    /*
49
     * Execute a callable if the collection isn't empty, then return the collection.
50
     *
51
     * @param callable callback
52
53
     * @return \Illuminate\Support\Collection
54
     */
55
    Collection::macro('ifAny', function (callable $callback): Collection {
56
        if (! $this->isEmpty()) {
57
            $callback($this);
58
        }
59
60
        return $this;
61
    });
62
}
63
64
if (! Collection::hasMacro('range')) {
65
    /*