Code Duplication    Length = 19-19 lines in 2 locations

src/Arrayy.php 2 locations

@@ 2374-2392 (lines=19) @@
2371
   *
2372
   * @return bool
2373
   */
2374
  public function matches(\Closure $closure): bool
2375
  {
2376
    if (\count($this->array, COUNT_NORMAL) === 0) {
2377
      return false;
2378
    }
2379
2380
    // init
2381
    $array = $this->array;
2382
2383
    foreach ($array as $key => $value) {
2384
      $value = $closure($value, $key);
2385
2386
      if ($value === false) {
2387
        return false;
2388
      }
2389
    }
2390
2391
    return true;
2392
  }
2393
2394
  /**
2395
   * Check if any item in the current array matches a truth test.
@@ 2401-2419 (lines=19) @@
2398
   *
2399
   * @return bool
2400
   */
2401
  public function matchesAny(\Closure $closure): bool
2402
  {
2403
    if (\count($this->array, COUNT_NORMAL) === 0) {
2404
      return false;
2405
    }
2406
2407
    // init
2408
    $array = $this->array;
2409
2410
    foreach ($array as $key => $value) {
2411
      $value = $closure($value, $key);
2412
2413
      if ($value === true) {
2414
        return true;
2415
      }
2416
    }
2417
2418
    return false;
2419
  }
2420
2421
  /**
2422
   * Get the max value from an array.