Code Duplication    Length = 11-12 lines in 2 locations

src/Arrayy.php 2 locations

@@ 1921-1931 (lines=11) @@
1918
     * @psalm-return static<TKey,T>
1919
     * @psalm-mutation-free
1920
     */
1921
    public function each(\Closure $closure): self
1922
    {
1923
        // init
1924
        $array = [];
1925
1926
        foreach ($this->getGenerator() as $key => $value) {
1927
            $array[$key] = $closure($value, $key);
1928
        }
1929
1930
        return static::create(
1931
            $array,
1932
            $this->iteratorClass,
1933
            false
1934
        );
@@ 4413-4424 (lines=12) @@
4410
     * @psalm-return static<TKey,T>
4411
     * @psalm-mutation-free
4412
     */
4413
    public function reject(\Closure $closure): self
4414
    {
4415
        // init
4416
        $filtered = [];
4417
4418
        foreach ($this->getGenerator() as $key => $value) {
4419
            if (!$closure($value, $key)) {
4420
                $filtered[$key] = $value;
4421
            }
4422
        }
4423
4424
        return static::create(
4425
            $filtered,
4426
            $this->iteratorClass,
4427
            false