class LinkedListNode {
protected $prev = null;
protected $next = null;
protected $value = null;
protected $list = null;
public function __construct($value, LinkedList $list) {
$this->value = $value;
$this->list = $list;
}
public static function create($value, LinkedList $list) {
if (is_object($value) && $value instanceof self) {
if ($list !== $value->list) {
throw new Exception('Crossing Lists!!!');
}
return $value;