DataStructures/Lists/DoublyLinkedList.php 1 location
|
@@ 57-64 (lines=8) @@
|
| 54 |
|
* @return mixed The data stored in the given index |
| 55 |
|
* @throws OutOfBoundsException if index is out bounds. |
| 56 |
|
*/ |
| 57 |
|
public function get($index) { |
| 58 |
|
$node = $this->search($index); |
| 59 |
|
if($node === null) { |
| 60 |
|
return null; |
| 61 |
|
} |
| 62 |
|
|
| 63 |
|
return $node->data; |
| 64 |
|
} |
| 65 |
|
|
| 66 |
|
/** |
| 67 |
|
* Gets the node stored in the position especified. |
DataStructures/Lists/SimpleLinkedList.php 1 location
|
@@ 68-75 (lines=8) @@
|
| 65 |
|
* @return mixed The data stored in the given index |
| 66 |
|
* @throws OutOfBoundsException if index is out bounds. |
| 67 |
|
*/ |
| 68 |
|
public function get($index) { |
| 69 |
|
$node = $this->search($index); |
| 70 |
|
if($node === null) { |
| 71 |
|
return null; |
| 72 |
|
} |
| 73 |
|
|
| 74 |
|
return $node->data; |
| 75 |
|
} |
| 76 |
|
|
| 77 |
|
/** |
| 78 |
|
* Returns the node stored in the given position. |
DataStructures/Lists/CircularLinkedList.php 1 location
|
@@ 145-152 (lines=8) @@
|
| 142 |
|
* @throws OutOfBoundsException if it is out of limits (< 0 or > size - 1) |
| 143 |
|
* @return mixed the data stored in $index node. |
| 144 |
|
*/ |
| 145 |
|
public function get($index) { |
| 146 |
|
$node = $this->search($index); |
| 147 |
|
if($node === null) { |
| 148 |
|
return null; |
| 149 |
|
} |
| 150 |
|
|
| 151 |
|
return $node->data; |
| 152 |
|
} |
| 153 |
|
|
| 154 |
|
/** |
| 155 |
|
* Returns the node stored in the given position. |