@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | public $next = null, $prev = null; //A reference to the next and previous node |
| 13 | 13 | public $data = null; //Data or a reference to data |
| 14 | 14 | |
| 15 | - public function __construct($data=null) |
|
| 15 | + public function __construct($data = null) |
|
| 16 | 16 | { |
| 17 | 17 | $this->data = $data; |
| 18 | 18 | } |
@@ -143,23 +143,23 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | public function get($index) |
| 145 | 145 | { |
| 146 | - if($index < 0 || $index > $this->size-1) |
|
| 146 | + if ($index < 0 || $index > $this->size-1) |
|
| 147 | 147 | { |
| 148 | 148 | throw new IndexOutOfBounds("The given index is out of bounds!"); |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - if($index == 0) |
|
| 151 | + if ($index == 0) |
|
| 152 | 152 | { |
| 153 | 153 | return $this->firstNode; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - if($index == $this->size-1) |
|
| 156 | + if ($index == $this->size-1) |
|
| 157 | 157 | { |
| 158 | 158 | return $this->lastNode; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | $node = $this->firstNode; |
| 162 | - for($i = 1; $i <= $index; $i++) |
|
| 162 | + for ($i = 1; $i <= $index; $i++) |
|
| 163 | 163 | { |
| 164 | 164 | $node = $node->next; |
| 165 | 165 | } |