| @@ 78-81 (lines=4) @@ | ||
| 75 | ||
| 76 | $current = $this->head; |
|
| 77 | $i = 0; |
|
| 78 | while($i < $index && $current->next !== null) { |
|
| 79 | $current = $current->next; |
|
| 80 | $i++; |
|
| 81 | } |
|
| 82 | ||
| 83 | return $current->data; |
|
| 84 | } |
|
| @@ 124-128 (lines=5) @@ | ||
| 121 | $i = 0; |
|
| 122 | $current = $this->head; |
|
| 123 | $prev = $current; |
|
| 124 | while($i < $index && $current->next !== null) { |
|
| 125 | $prev = $current; |
|
| 126 | $current = $current->next; |
|
| 127 | $i++; |
|
| 128 | } |
|
| 129 | ||
| 130 | $prev->next = &$newNode; |
|
| 131 | $newNode->next = &$current; |
|
| @@ 167-170 (lines=4) @@ | ||
| 164 | $i = 0; |
|
| 165 | $current = $this->head; |
|
| 166 | $prev = $current; |
|
| 167 | while($i < $index && $current->next !== null) { |
|
| 168 | $prev = $current; |
|
| 169 | $current = $current->next; |
|
| 170 | } |
|
| 171 | $prev->next = $current->next; |
|
| 172 | $this->size--; |
|
| 173 | ||