| @@ 1350-1363 (lines=14) @@ | ||
| 1347 | * |
|
| 1348 | * @return bool |
|
| 1349 | */ |
|
| 1350 | public function matches(\Closure $closure) |
|
| 1351 | { |
|
| 1352 | // Reduce the array to only booleans |
|
| 1353 | $array = $this->each($closure); |
|
| 1354 | ||
| 1355 | // Check the results |
|
| 1356 | if (count($array) === 0) { |
|
| 1357 | return true; |
|
| 1358 | } |
|
| 1359 | ||
| 1360 | $array = array_search(false, $array->toArray(), false); |
|
| 1361 | ||
| 1362 | return is_bool($array); |
|
| 1363 | } |
|
| 1364 | ||
| 1365 | /** |
|
| 1366 | * Check if any item in the current array matches a truth test. |
|
| @@ 1372-1385 (lines=14) @@ | ||
| 1369 | * |
|
| 1370 | * @return bool |
|
| 1371 | */ |
|
| 1372 | public function matchesAny(\Closure $closure) |
|
| 1373 | { |
|
| 1374 | // Reduce the array to only booleans |
|
| 1375 | $array = $this->each($closure); |
|
| 1376 | ||
| 1377 | // Check the results |
|
| 1378 | if (count($array) === 0) { |
|
| 1379 | return true; |
|
| 1380 | } |
|
| 1381 | ||
| 1382 | $array = array_search(true, $array->toArray(), false); |
|
| 1383 | ||
| 1384 | return is_int($array); |
|
| 1385 | } |
|
| 1386 | ||
| 1387 | /** |
|
| 1388 | * Get the max value from an array. |
|