-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNode.php
34 lines (32 loc) · 948 Bytes
/
Node.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
namespace Web4cstj\Document;
class Node {
public $previousSibling = null;
public $nextSibling = null;
public $parentNode = null;
public function __construct()
{
}
public function remove() {
if ($this->parentNode === null) {
return $this;
}
if ($this->previousSibling === null) {
$this->parentNode->firstChild = $this->nextSibling;
} else {
$this->previousSibling->nextSibling = $this->nextSibling;
}
if ($this->nextSibling === null) {
$this->parentNode->lastChild = $this->previousSibling;
} else {
$this->previousSibling->nextSibling = $this->nextSibling;
}
$this->parentNode = null;
$this->nextSibling = null;
$this->previousSibling = null;
return $this;
}
static public function slug($text) {
return \URLify::slug($text);
}
}