| @@ 1330-1343 (lines=14) @@ | ||
| 1327 | * |
|
| 1328 | * @return bool |
|
| 1329 | */ |
|
| 1330 | public function matches(\Closure $closure) |
|
| 1331 | { |
|
| 1332 | // Reduce the array to only booleans |
|
| 1333 | $array = $this->each($closure); |
|
| 1334 | ||
| 1335 | // Check the results |
|
| 1336 | if (count($array) === 0) { |
|
| 1337 | return true; |
|
| 1338 | } |
|
| 1339 | ||
| 1340 | $array = array_search(false, $array->toArray(), false); |
|
| 1341 | ||
| 1342 | return is_bool($array); |
|
| 1343 | } |
|
| 1344 | ||
| 1345 | /** |
|
| 1346 | * Check if any item in the current array matches a truth test. |
|
| @@ 1352-1365 (lines=14) @@ | ||
| 1349 | * |
|
| 1350 | * @return bool |
|
| 1351 | */ |
|
| 1352 | public function matchesAny(\Closure $closure) |
|
| 1353 | { |
|
| 1354 | // Reduce the array to only booleans |
|
| 1355 | $array = $this->each($closure); |
|
| 1356 | ||
| 1357 | // Check the results |
|
| 1358 | if (count($array) === 0) { |
|
| 1359 | return true; |
|
| 1360 | } |
|
| 1361 | ||
| 1362 | $array = array_search(true, $array->toArray(), false); |
|
| 1363 | ||
| 1364 | return is_int($array); |
|
| 1365 | } |
|
| 1366 | ||
| 1367 | /** |
|
| 1368 | * Get the max value from an array. |
|