Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 10 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| SelfclosingTagTk | |
0.00% |
0 / 10 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| __clone | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| newFromJsonArray | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | declare( strict_types = 1 ); |
| 3 | |
| 4 | namespace Wikimedia\Parsoid\Tokens; |
| 5 | |
| 6 | use Wikimedia\Parsoid\NodeData\DataMw; |
| 7 | use Wikimedia\Parsoid\NodeData\DataParsoid; |
| 8 | |
| 9 | /** |
| 10 | * Token for a self-closing tag (HTML or otherwise) |
| 11 | */ |
| 12 | class SelfclosingTagTk extends XMLTagTk { |
| 13 | /** |
| 14 | * @param string $name |
| 15 | * @param KV[] $attribs |
| 16 | * @param ?DataParsoid $dataParsoid |
| 17 | * @param ?DataMw $dataMw |
| 18 | */ |
| 19 | public function __construct( |
| 20 | string $name, array $attribs = [], |
| 21 | ?DataParsoid $dataParsoid = null, |
| 22 | ?DataMw $dataMw = null |
| 23 | ) { |
| 24 | parent::__construct( $dataParsoid, $dataMw ); |
| 25 | $this->name = $name; |
| 26 | $this->attribs = $attribs; |
| 27 | } |
| 28 | |
| 29 | public function __clone() { |
| 30 | parent::__clone(); |
| 31 | // No new non-primitive properties to clone. |
| 32 | } |
| 33 | |
| 34 | /** @inheritDoc */ |
| 35 | public static function newFromJsonArray( array $json ) { |
| 36 | return new self( |
| 37 | $json['name'], |
| 38 | $json['attribs'] ?? [], |
| 39 | $json['dataParsoid'] ?? null, |
| 40 | $json['dataMw'] ?? null |
| 41 | ); |
| 42 | } |
| 43 | } |