| @@ 4267-4282 (lines=16) @@ | ||
| 4264 | * |
|
| 4265 | * @phpstan-param \Closure(T=,TKey=):bool $closure |
|
| 4266 | */ |
|
| 4267 | public function matches(\Closure $closure): bool |
|
| 4268 | { |
|
| 4269 | if ($this->count() === 0) { |
|
| 4270 | return false; |
|
| 4271 | } |
|
| 4272 | ||
| 4273 | foreach ($this->getGenerator() as $key => $value) { |
|
| 4274 | $value = $closure($value, $key); |
|
| 4275 | ||
| 4276 | if ($value === false) { |
|
| 4277 | return false; |
|
| 4278 | } |
|
| 4279 | } |
|
| 4280 | ||
| 4281 | return true; |
|
| 4282 | } |
|
| 4283 | ||
| 4284 | /** |
|
| 4285 | * Check if any item in the current array matches a truth test. |
|
| @@ 4300-4315 (lines=16) @@ | ||
| 4297 | * |
|
| 4298 | * @phpstan-param \Closure(T=,TKey=):bool $closure |
|
| 4299 | */ |
|
| 4300 | public function matchesAny(\Closure $closure): bool |
|
| 4301 | { |
|
| 4302 | if ($this->count() === 0) { |
|
| 4303 | return false; |
|
| 4304 | } |
|
| 4305 | ||
| 4306 | foreach ($this->getGenerator() as $key => $value) { |
|
| 4307 | $value = $closure($value, $key); |
|
| 4308 | ||
| 4309 | if ($value === true) { |
|
| 4310 | return true; |
|
| 4311 | } |
|
| 4312 | } |
|
| 4313 | ||
| 4314 | return false; |
|
| 4315 | } |
|
| 4316 | ||
| 4317 | /** |
|
| 4318 | * Get the max value from an array. |
|