| @@ 1439-1452 (lines=14) @@ | ||
| 1436 | * |
|
| 1437 | * @return bool |
|
| 1438 | */ |
|
| 1439 | public function matches(\Closure $closure) |
|
| 1440 | { |
|
| 1441 | // Reduce the array to only booleans |
|
| 1442 | $array = $this->each($closure); |
|
| 1443 | ||
| 1444 | // Check the results |
|
| 1445 | if (count($array) === 0) { |
|
| 1446 | return true; |
|
| 1447 | } |
|
| 1448 | ||
| 1449 | $array = array_search(false, $array->toArray(), false); |
|
| 1450 | ||
| 1451 | return is_bool($array); |
|
| 1452 | } |
|
| 1453 | ||
| 1454 | /** |
|
| 1455 | * Check if any item in the current array matches a truth test. |
|
| @@ 1461-1474 (lines=14) @@ | ||
| 1458 | * |
|
| 1459 | * @return bool |
|
| 1460 | */ |
|
| 1461 | public function matchesAny(\Closure $closure) |
|
| 1462 | { |
|
| 1463 | // Reduce the array to only booleans |
|
| 1464 | $array = $this->each($closure); |
|
| 1465 | ||
| 1466 | // Check the results |
|
| 1467 | if (count($array) === 0) { |
|
| 1468 | return true; |
|
| 1469 | } |
|
| 1470 | ||
| 1471 | $array = array_search(true, $array->toArray(), false); |
|
| 1472 | ||
| 1473 | return is_int($array); |
|
| 1474 | } |
|
| 1475 | ||
| 1476 | /** |
|
| 1477 | * Get the max value from an array. |
|