Code Duplication    Length = 19-19 lines in 2 locations

src/Arrayy.php 2 locations

@@ 2474-2492 (lines=19) @@
2471
   *
2472
   * @return bool
2473
   */
2474
  public function matches(\Closure $closure): bool
2475
  {
2476
    if (\count($this->array, COUNT_NORMAL) === 0) {
2477
      return false;
2478
    }
2479
2480
    // init
2481
    $array = $this->array;
2482
2483
    foreach ($array as $key => $value) {
2484
      $value = $closure($value, $key);
2485
2486
      if ($value === false) {
2487
        return false;
2488
      }
2489
    }
2490
2491
    return true;
2492
  }
2493
2494
  /**
2495
   * Check if any item in the current array matches a truth test.
@@ 2501-2519 (lines=19) @@
2498
   *
2499
   * @return bool
2500
   */
2501
  public function matchesAny(\Closure $closure): bool
2502
  {
2503
    if (\count($this->array, COUNT_NORMAL) === 0) {
2504
      return false;
2505
    }
2506
2507
    // init
2508
    $array = $this->array;
2509
2510
    foreach ($array as $key => $value) {
2511
      $value = $closure($value, $key);
2512
2513
      if ($value === true) {
2514
        return true;
2515
      }
2516
    }
2517
2518
    return false;
2519
  }
2520
2521
  /**
2522
   * Get the max value from an array.