| @@ 97-105 (lines=9) @@ | ||
| 94 | * @param int $index |
|
| 95 | * @return multitype |
|
| 96 | */ |
|
| 97 | public function get($index) |
|
| 98 | { |
|
| 99 | $this->checkInt($index); |
|
| 100 | if(!array_key_exists($index, $this->array)) |
|
| 101 | { |
|
| 102 | throw new IndexOutOfBoundsException($index); |
|
| 103 | } |
|
| 104 | return $this->array[$index]; |
|
| 105 | } |
|
| 106 | ||
| 107 | /** |
|
| 108 | * Returns the index of the first occurrence of the |
|
| @@ 248-258 (lines=11) @@ | ||
| 245 | * @return void |
|
| 246 | * @throws IndexOutOfBoundsException |
|
| 247 | */ |
|
| 248 | public function set($index, $element) |
|
| 249 | { |
|
| 250 | if(array_key_exists($index, $this->array)) |
|
| 251 | { |
|
| 252 | $this->array[$index] = $element; |
|
| 253 | } |
|
| 254 | else |
|
| 255 | { |
|
| 256 | throw new IndexOutOfBoundsException($index); |
|
| 257 | } |
|
| 258 | } |
|
| 259 | ||
| 260 | /** |
|
| 261 | * Returns the number of elements in this list. |
|