| @@ 2301-2316 (lines=16) @@ | ||
| 2298 | * |
|
| 2299 | * @return bool |
|
| 2300 | */ |
|
| 2301 | public function matches(\Closure $closure): bool |
|
| 2302 | { |
|
| 2303 | if (\count($this->array, \COUNT_NORMAL) === 0) { |
|
| 2304 | return false; |
|
| 2305 | } |
|
| 2306 | ||
| 2307 | foreach ($this->getGenerator() as $key => $value) { |
|
| 2308 | $value = $closure($value, $key); |
|
| 2309 | ||
| 2310 | if ($value === false) { |
|
| 2311 | return false; |
|
| 2312 | } |
|
| 2313 | } |
|
| 2314 | ||
| 2315 | return true; |
|
| 2316 | } |
|
| 2317 | ||
| 2318 | /** |
|
| 2319 | * Check if any item in the current array matches a truth test. |
|
| @@ 2325-2340 (lines=16) @@ | ||
| 2322 | * |
|
| 2323 | * @return bool |
|
| 2324 | */ |
|
| 2325 | public function matchesAny(\Closure $closure): bool |
|
| 2326 | { |
|
| 2327 | if (\count($this->array, \COUNT_NORMAL) === 0) { |
|
| 2328 | return false; |
|
| 2329 | } |
|
| 2330 | ||
| 2331 | foreach ($this->getGenerator() as $key => $value) { |
|
| 2332 | $value = $closure($value, $key); |
|
| 2333 | ||
| 2334 | if ($value === true) { |
|
| 2335 | return true; |
|
| 2336 | } |
|
| 2337 | } |
|
| 2338 | ||
| 2339 | return false; |
|
| 2340 | } |
|
| 2341 | ||
| 2342 | /** |
|
| 2343 | * Get the max value from an array. |
|