Code Duplication    Length = 19-19 lines in 2 locations

src/Arrayy.php 2 locations

@@ 2414-2432 (lines=19) @@
2411
   *
2412
   * @return bool
2413
   */
2414
  public function matches(\Closure $closure): bool
2415
  {
2416
    if (\count($this->array, COUNT_NORMAL) === 0) {
2417
      return false;
2418
    }
2419
2420
    // init
2421
    $array = $this->array;
2422
2423
    foreach ($array as $key => $value) {
2424
      $value = $closure($value, $key);
2425
2426
      if ($value === false) {
2427
        return false;
2428
      }
2429
    }
2430
2431
    return true;
2432
  }
2433
2434
  /**
2435
   * Check if any item in the current array matches a truth test.
@@ 2441-2459 (lines=19) @@
2438
   *
2439
   * @return bool
2440
   */
2441
  public function matchesAny(\Closure $closure): bool
2442
  {
2443
    if (\count($this->array, COUNT_NORMAL) === 0) {
2444
      return false;
2445
    }
2446
2447
    // init
2448
    $array = $this->array;
2449
2450
    foreach ($array as $key => $value) {
2451
      $value = $closure($value, $key);
2452
2453
      if ($value === true) {
2454
        return true;
2455
      }
2456
    }
2457
2458
    return false;
2459
  }
2460
2461
  /**
2462
   * Get the max value from an array.