Code Duplication    Length = 19-19 lines in 2 locations

src/Arrayy.php 2 locations

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