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