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
        );
@@ 4415-4426 (lines=12) @@
4412
     * @psalm-return static<TKey,T>
4413
     * @psalm-mutation-free
4414
     */
4415
    public function reject(\Closure $closure): self
4416
    {
4417
        // init
4418
        $filtered = [];
4419
4420
        foreach ($this->getGenerator() as $key => $value) {
4421
            if (!$closure($value, $key)) {
4422
                $filtered[$key] = $value;
4423
            }
4424
        }
4425
4426
        return static::create(
4427
            $filtered,
4428
            $this->iteratorClass,
4429
            false