Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 11
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
TagTk
0.00% covered (danger)
0.00%
0 / 11
0.00% covered (danger)
0.00%
0 / 3
12
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 getName
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 jsonSerialize
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2declare( strict_types = 1 );
3
4namespace Wikimedia\Parsoid\Tokens;
5
6use Wikimedia\Parsoid\NodeData\DataMw;
7use Wikimedia\Parsoid\NodeData\DataParsoid;
8
9/**
10 * HTML tag token
11 */
12class TagTk extends Token {
13    /** @var string Name of the end tag */
14    private $name;
15
16    /**
17     * @param string $name
18     * @param KV[] $attribs
19     * @param ?DataParsoid $dataParsoid data-parsoid object
20     * @param ?DataMw $dataMw data-mw object
21     */
22    public function __construct(
23        string $name, array $attribs = [],
24        ?DataParsoid $dataParsoid = null,
25        ?DataMw $dataMw = null
26    ) {
27        parent::__construct( $dataParsoid, $dataMw );
28        $this->name = $name;
29        $this->attribs = $attribs;
30    }
31
32    public function getName(): string {
33        return $this->name;
34    }
35
36    /**
37     * @inheritDoc
38     */
39    public function jsonSerialize(): array {
40        return [
41            'type' => $this->getType(),
42            'name' => $this->name,
43            'attribs' => $this->attribs,
44            'dataParsoid' => $this->dataParsoid,
45            'dataMw' => $this->dataMw,
46        ];
47    }
48}