@@ 4260-4275 (lines=16) @@ | ||
4257 | * |
|
4258 | * @phpstan-param \Closure(T=,TKey=):bool $closure |
|
4259 | */ |
|
4260 | public function matches(\Closure $closure): bool |
|
4261 | { |
|
4262 | if ($this->count() === 0) { |
|
4263 | return false; |
|
4264 | } |
|
4265 | ||
4266 | foreach ($this->getGenerator() as $key => $value) { |
|
4267 | $value = $closure($value, $key); |
|
4268 | ||
4269 | if ($value === false) { |
|
4270 | return false; |
|
4271 | } |
|
4272 | } |
|
4273 | ||
4274 | return true; |
|
4275 | } |
|
4276 | ||
4277 | /** |
|
4278 | * Check if any item in the current array matches a truth test. |
|
@@ 4293-4308 (lines=16) @@ | ||
4290 | * |
|
4291 | * @phpstan-param \Closure(T=,TKey=):bool $closure |
|
4292 | */ |
|
4293 | public function matchesAny(\Closure $closure): bool |
|
4294 | { |
|
4295 | if ($this->count() === 0) { |
|
4296 | return false; |
|
4297 | } |
|
4298 | ||
4299 | foreach ($this->getGenerator() as $key => $value) { |
|
4300 | $value = $closure($value, $key); |
|
4301 | ||
4302 | if ($value === true) { |
|
4303 | return true; |
|
4304 | } |
|
4305 | } |
|
4306 | ||
4307 | return false; |
|
4308 | } |
|
4309 | ||
4310 | /** |
|
4311 | * Get the max value from an array. |