Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| SerializerNode | |
0.00% |
0 / 7 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
2 | |||
| getDebugTag | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | declare( strict_types = 1 ); |
| 3 | |
| 4 | namespace Wikimedia\RemexHtml\Serializer; |
| 5 | |
| 6 | use Wikimedia\RemexHtml\PropGuard; |
| 7 | use Wikimedia\RemexHtml\Tokenizer\Attributes; |
| 8 | |
| 9 | class SerializerNode { |
| 10 | use PropGuard; |
| 11 | |
| 12 | /** @var int The integer index into Serializer::$nodes of this node */ |
| 13 | public $id; |
| 14 | |
| 15 | /** @var int The integer index into Serializer::$nodes of the parent node */ |
| 16 | public $parentId; |
| 17 | |
| 18 | /** @var string The element namespace */ |
| 19 | public $namespace; |
| 20 | |
| 21 | /** @var string The element name */ |
| 22 | public $name; |
| 23 | |
| 24 | /** @var Attributes */ |
| 25 | public $attrs; |
| 26 | |
| 27 | /** |
| 28 | * @var bool The void flag as in TreeHandler::insertElement |
| 29 | * @see \Wikimedia\RemexHtml\TreeBuilder\TreeHandler::insertElement |
| 30 | */ |
| 31 | public $void; |
| 32 | |
| 33 | /** @var (self|string)[] */ |
| 34 | public $children = []; |
| 35 | |
| 36 | /** |
| 37 | * Arbitrary user data can be placed here. |
| 38 | * |
| 39 | * @var mixed |
| 40 | */ |
| 41 | public $snData; |
| 42 | |
| 43 | /** |
| 44 | * @param int $id The integer index into Serializer::$nodes of this node |
| 45 | * @param int $parentId The integer index into Serializer::$nodes of the parent node |
| 46 | * @param string $namespace The XML namespace |
| 47 | * @param string $name The element name |
| 48 | * @param Attributes $attrs The element attributes |
| 49 | * @param bool $void The void flag as in TreeHandler::insertElement |
| 50 | */ |
| 51 | public function __construct( $id, $parentId, $namespace, $name, $attrs, $void ) { |
| 52 | $this->id = $id; |
| 53 | $this->parentId = $parentId; |
| 54 | $this->namespace = $namespace; |
| 55 | $this->name = $name; |
| 56 | $this->attrs = $attrs; |
| 57 | $this->void = $void; |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * Get a string identifying the node, for use in debugging. |
| 62 | * @return string |
| 63 | */ |
| 64 | public function getDebugTag() { |
| 65 | return $this->name . '#' . $this->id; |
| 66 | } |
| 67 | } |