Code Duplication    Length = 19-19 lines in 2 locations

src/Arrayy.php 2 locations

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