| @@ 1395-1408 (lines=14) @@ | ||
| 1392 | * |
|
| 1393 | * @return bool |
|
| 1394 | */ |
|
| 1395 | public function matches(\Closure $closure) |
|
| 1396 | { |
|
| 1397 | // Reduce the array to only booleans |
|
| 1398 | $array = $this->each($closure); |
|
| 1399 | ||
| 1400 | // Check the results |
|
| 1401 | if (count($array) === 0) { |
|
| 1402 | return true; |
|
| 1403 | } |
|
| 1404 | ||
| 1405 | $array = array_search(false, $array->toArray(), false); |
|
| 1406 | ||
| 1407 | return is_bool($array); |
|
| 1408 | } |
|
| 1409 | ||
| 1410 | /** |
|
| 1411 | * Check if any item in the current array matches a truth test. |
|
| @@ 1417-1430 (lines=14) @@ | ||
| 1414 | * |
|
| 1415 | * @return bool |
|
| 1416 | */ |
|
| 1417 | public function matchesAny(\Closure $closure) |
|
| 1418 | { |
|
| 1419 | // Reduce the array to only booleans |
|
| 1420 | $array = $this->each($closure); |
|
| 1421 | ||
| 1422 | // Check the results |
|
| 1423 | if (count($array) === 0) { |
|
| 1424 | return true; |
|
| 1425 | } |
|
| 1426 | ||
| 1427 | $array = array_search(true, $array->toArray(), false); |
|
| 1428 | ||
| 1429 | return is_int($array); |
|
| 1430 | } |
|
| 1431 | ||
| 1432 | /** |
|
| 1433 | * Get the max value from an array. |
|