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