| @@ 66-79 (lines=14) @@ | ||
| 63 | * |
|
| 64 | * @return ArrayExpectations |
|
| 65 | */ |
|
| 66 | public function isAny(callable $callback): self |
|
| 67 | { |
|
| 68 | if (!$this->isApproved()) { |
|
| 69 | return $this; |
|
| 70 | } |
|
| 71 | ||
| 72 | foreach ($this->value as $value) { |
|
| 73 | if ($this->approveIf($callback($value))->isApproved()) { |
|
| 74 | break; |
|
| 75 | } |
|
| 76 | } |
|
| 77 | ||
| 78 | return $this; |
|
| 79 | } |
|
| 80 | ||
| 81 | /** |
|
| 82 | * @param callable $callback |
|
| @@ 86-99 (lines=14) @@ | ||
| 83 | * |
|
| 84 | * @return ArrayExpectations |
|
| 85 | */ |
|
| 86 | public function isAll(callable $callback): self |
|
| 87 | { |
|
| 88 | if (!$this->isApproved()) { |
|
| 89 | return $this; |
|
| 90 | } |
|
| 91 | ||
| 92 | foreach ($this->value as $value) { |
|
| 93 | if (!$this->approveIf($callback($value))->isApproved()) { |
|
| 94 | break; |
|
| 95 | } |
|
| 96 | } |
|
| 97 | ||
| 98 | return $this; |
|
| 99 | } |
|
| 100 | } |
|