Code Duplication    Length = 7-10 lines in 3 locations

src/Arrayy.php 3 locations

@@ 2399-2405 (lines=7) @@
2396
                }
2397
            };
2398
        } else {
2399
            $generator = function () use ($closure) {
2400
                foreach ($this->getGenerator() as $key => $value) {
2401
                    if ($closure($value) === true) {
2402
                        yield $key => $value;
2403
                    }
2404
                }
2405
            };
2406
        }
2407
2408
        return static::create(
@@ 2533-2542 (lines=10) @@
2530
     * @return false|mixed
2531
     *                     <p>Return false if we did not find the value.</p>
2532
     */
2533
    public function find(\Closure $closure)
2534
    {
2535
        foreach ($this->getGenerator() as $key => $value) {
2536
            if ($closure($value, $key)) {
2537
                return $value;
2538
            }
2539
        }
2540
2541
        return false;
2542
    }
2543
2544
    /**
2545
     * find by ...
@@ 6738-6747 (lines=10) @@
6735
     * @return bool
6736
     *              <p>TRUE, if the predicate yields TRUE for all elements, FALSE otherwise.</p>
6737
     */
6738
    public function validate(\Closure $closure): bool
6739
    {
6740
        foreach ($this->getGenerator() as $key => $value) {
6741
            if (!$closure($value, $key)) {
6742
                return false;
6743
            }
6744
        }
6745
6746
        return true;
6747
    }
6748
6749
    /**
6750
     * Get all values from a array.