| @@ 1283-1296 (lines=14) @@ | ||
| 1280 | * |
|
| 1281 | * @return bool |
|
| 1282 | */ |
|
| 1283 | public function matches(\Closure $closure) |
|
| 1284 | { |
|
| 1285 | // Reduce the array to only booleans |
|
| 1286 | $array = $this->each($closure); |
|
| 1287 | ||
| 1288 | // Check the results |
|
| 1289 | if (count($array) === 0) { |
|
| 1290 | return true; |
|
| 1291 | } |
|
| 1292 | ||
| 1293 | $array = array_search(false, $array->toArray(), false); |
|
| 1294 | ||
| 1295 | return is_bool($array); |
|
| 1296 | } |
|
| 1297 | ||
| 1298 | /** |
|
| 1299 | * Check if any item in the current array matches a truth test. |
|
| @@ 1305-1318 (lines=14) @@ | ||
| 1302 | * |
|
| 1303 | * @return bool |
|
| 1304 | */ |
|
| 1305 | public function matchesAny(\Closure $closure) |
|
| 1306 | { |
|
| 1307 | // Reduce the array to only booleans |
|
| 1308 | $array = $this->each($closure); |
|
| 1309 | ||
| 1310 | // Check the results |
|
| 1311 | if (count($array) === 0) { |
|
| 1312 | return true; |
|
| 1313 | } |
|
| 1314 | ||
| 1315 | $array = array_search(true, $array->toArray(), false); |
|
| 1316 | ||
| 1317 | return is_int($array); |
|
| 1318 | } |
|
| 1319 | ||
| 1320 | /** |
|
| 1321 | * Get the max value from an array. |
|