| @@ 97-106 (lines=10) @@ | ||
| 94 | return $this->items[$key]; |
|
| 95 | } |
|
| 96 | ||
| 97 | public function search(Equatable $value): string |
|
| 98 | { |
|
| 99 | foreach ($this->items as $key => $item) { |
|
| 100 | if ($item->equals($value)) { |
|
| 101 | return $key; |
|
| 102 | } |
|
| 103 | } |
|
| 104 | ||
| 105 | throw OutOfRangeException::valueOutOfRange($value); |
|
| 106 | } |
|
| 107 | ||
| 108 | public function searchAll(Equatable $value): array |
|
| 109 | { |
|
| @@ 93-102 (lines=10) @@ | ||
| 90 | return $this->items[$index]; |
|
| 91 | } |
|
| 92 | ||
| 93 | public function search(Equatable $value): int |
|
| 94 | { |
|
| 95 | foreach ($this->items as $index => $item) { |
|
| 96 | if ($item->equals($value)) { |
|
| 97 | return $index; |
|
| 98 | } |
|
| 99 | } |
|
| 100 | ||
| 101 | throw OutOfRangeException::valueOutOfRange($value); |
|
| 102 | } |
|
| 103 | ||
| 104 | public function searchAll(Equatable $value): array |
|
| 105 | { |
|