Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
NlTk
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 2
20
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
12
 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\DataMw;
7use Wikimedia\Parsoid\NodeData\DataParsoid;
8
9/**
10 * Newline token.
11 */
12class NlTk extends Token {
13    /**
14     * @param ?SourceRange $tsr
15     *    TSR ("tag source range") represents the (start, end) wikitext
16     *    byte offsets for a token (in this case, the newline) in the
17     *    UTF8-encoded source string
18     * @param ?DataParsoid $dataParsoid
19     * @param ?DataMw $dataMw
20     */
21    public function __construct(
22        ?SourceRange $tsr,
23        ?DataParsoid $dataParsoid = null,
24        ?DataMw $dataMw = null
25    ) {
26        parent::__construct( $dataParsoid, $dataMw );
27        if ( $dataParsoid == null && $tsr !== null ) {
28            $this->dataParsoid->tsr = $tsr;
29        }
30    }
31
32    /**
33     * @inheritDoc
34     */
35    public function jsonSerialize(): array {
36        return [
37            'type' => $this->getType(),
38            'dataParsoid' => $this->dataParsoid,
39            'dataMw' => $this->dataMw,
40        ];
41    }
42}