mirror of
https://github.com/TheAlgorithms/PHP.git
synced 2025-07-09 19:16:19 +02:00
44 lines
763 B
PHP
44 lines
763 B
PHP
<?php
|
|
|
|
namespace DataStructures\ReverseLinkedList;
|
|
|
|
class LinkedListItem
|
|
{
|
|
private ?LinkedListItem $next = null;
|
|
private ?LinkedListItem $prev = null;
|
|
private $value;
|
|
|
|
public function setNext(?LinkedListItem $next)
|
|
{
|
|
$this->next = $next;
|
|
return $this;
|
|
}
|
|
|
|
public function getNext(): ?LinkedListItem
|
|
{
|
|
return $this->next;
|
|
}
|
|
|
|
public function setPrev(?LinkedListItem $prev)
|
|
{
|
|
$this->prev = $prev;
|
|
return $this;
|
|
}
|
|
|
|
public function getPrev(): ?LinkedListItem
|
|
{
|
|
return $this->prev;
|
|
}
|
|
|
|
public function setValue($value)
|
|
{
|
|
$this->value = $value;
|
|
return $this;
|
|
}
|
|
|
|
public function getValue()
|
|
{
|
|
return $this->value;
|
|
}
|
|
}
|