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