Code Duplication    Length = 11-12 lines in 2 locations

src/Arrayy.php 2 locations

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