Code Duplication    Length = 11-12 lines in 2 locations

src/Arrayy.php 2 locations

@@ 2006-2016 (lines=11) @@
2003
     * @psalm-return static<TKey,T>
2004
     * @psalm-mutation-free
2005
     */
2006
    public function each(\Closure $closure): self
2007
    {
2008
        // init
2009
        $array = [];
2010
2011
        foreach ($this->getGenerator() as $key => $value) {
2012
            $array[$key] = $closure($value, $key);
2013
        }
2014
2015
        return static::create(
2016
            $array,
2017
            $this->iteratorClass,
2018
            false
2019
        );
@@ 4583-4594 (lines=12) @@
4580
     * @psalm-return static<TKey,T>
4581
     * @psalm-mutation-free
4582
     */
4583
    public function reject(\Closure $closure): self
4584
    {
4585
        // init
4586
        $filtered = [];
4587
4588
        foreach ($this->getGenerator() as $key => $value) {
4589
            if (!$closure($value, $key)) {
4590
                $filtered[$key] = $value;
4591
            }
4592
        }
4593
4594
        return static::create(
4595
            $filtered,
4596
            $this->iteratorClass,
4597
            false