Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
CommentTk
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 2
6
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 jsonSerialize
0.00% covered (danger)
0.00%
0 / 5
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\DataParsoid;
7
8/**
9 * Represents a comment
10 */
11class CommentTk extends Token {
12    /** @var string Comment text */
13    public $value;
14
15    public function __construct(
16        string $value, ?DataParsoid $dataParsoid = null
17    ) {
18        $this->value = $value;
19
20        // Won't survive in the DOM, but still useful for token serialization
21        // FIXME: verify if this is still required given that html->wt doesn't
22        // use tokens anymore. That was circa 2012 serializer code.
23        $this->dataParsoid = $dataParsoid ?? new DataParsoid;
24    }
25
26    /**
27     * @inheritDoc
28     */
29    public function jsonSerialize(): array {
30        return [
31            'type' => $this->getType(),
32            'value' => $this->value,
33            'dataParsoid' => $this->dataParsoid
34        ];
35    }
36}