@@ 258-270 (lines=13) @@ | ||
255 | * |
|
256 | * @return bool |
|
257 | */ |
|
258 | public function matches(\Closure $closure) |
|
259 | { |
|
260 | // Reduce the array to only booleans |
|
261 | $array = $this->each($closure); |
|
262 | ||
263 | // Check the results |
|
264 | if (count($array) === 0) { |
|
265 | return true; |
|
266 | } |
|
267 | $array = array_search(false, $array, false); |
|
268 | ||
269 | return is_bool($array); |
|
270 | } |
|
271 | ||
272 | /** |
|
273 | * Check if any item in the current array matches a truth test. |
|
@@ 279-291 (lines=13) @@ | ||
276 | * |
|
277 | * @return bool |
|
278 | */ |
|
279 | public function matchesAny(\Closure $closure) |
|
280 | { |
|
281 | // Reduce the array to only booleans |
|
282 | $array = $this->each($closure); |
|
283 | ||
284 | // Check the results |
|
285 | if (count($array) === 0) { |
|
286 | return true; |
|
287 | } |
|
288 | $array = array_search(true, $array, false); |
|
289 | ||
290 | return is_int($array); |
|
291 | } |
|
292 | ||
293 | /** |
|
294 | * Check if we have named keys in the current array. |