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