Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 13 |
|
0.00% |
0 / 10 |
CRAP | |
0.00% |
0 / 1 |
Segment | |
0.00% |
0 / 13 |
|
0.00% |
0 / 10 |
110 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
getContent | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setContent | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
addContent | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getStartOffset | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setStartOffset | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getEndOffset | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setEndOffset | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getHash | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setHash | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Wikispeech\Segment; |
4 | |
5 | /** |
6 | * @file |
7 | * @ingroup Extensions |
8 | * @license GPL-2.0-or-later |
9 | */ |
10 | |
11 | /** |
12 | * @since 0.1.10 |
13 | */ |
14 | class Segment { |
15 | |
16 | /** @var CleanedText[] */ |
17 | private $content; |
18 | |
19 | /** |
20 | * The offset of the first character of the segment, within the text node it appears. |
21 | * Used to determine start of a segment in the original HTML. |
22 | * @var int|null |
23 | */ |
24 | private $startOffset; |
25 | |
26 | /** |
27 | * The offset of the last character of the segment within the text node it appears. |
28 | * Used to determine end of a segment in the original HTML. |
29 | * @var int|null |
30 | */ |
31 | private $endOffset; |
32 | |
33 | /** @var string|null */ |
34 | private $hash; |
35 | |
36 | /** |
37 | * @since 0.1.10 |
38 | * @param CleanedText[] $content |
39 | * @param int|null $startOffset |
40 | * @param int|null $endOffset |
41 | * @param string|null $hash |
42 | */ |
43 | public function __construct( |
44 | array $content = [], |
45 | ?int $startOffset = null, |
46 | ?int $endOffset = null, |
47 | ?string $hash = null |
48 | ) { |
49 | $this->content = $content; |
50 | $this->startOffset = $startOffset; |
51 | $this->endOffset = $endOffset; |
52 | $this->hash = $hash; |
53 | } |
54 | |
55 | /** |
56 | * @since 0.1.10 |
57 | * @return CleanedText[] |
58 | */ |
59 | public function getContent(): array { |
60 | return $this->content; |
61 | } |
62 | |
63 | /** |
64 | * @since 0.1.10 |
65 | * @param CleanedText[] $content |
66 | */ |
67 | public function setContent( array $content ): void { |
68 | $this->content = $content; |
69 | } |
70 | |
71 | /** |
72 | * @since 0.1.10 |
73 | * @param CleanedText $content |
74 | */ |
75 | public function addContent( CleanedText $content ): void { |
76 | $this->content[] = $content; |
77 | } |
78 | |
79 | /** |
80 | * @since 0.1.10 |
81 | * @return int|null |
82 | */ |
83 | public function getStartOffset(): ?int { |
84 | return $this->startOffset; |
85 | } |
86 | |
87 | /** |
88 | * @since 0.1.10 |
89 | * @param int|null $startOffset |
90 | */ |
91 | public function setStartOffset( ?int $startOffset ): void { |
92 | $this->startOffset = $startOffset; |
93 | } |
94 | |
95 | /** |
96 | * @since 0.1.10 |
97 | * @return int|null |
98 | */ |
99 | public function getEndOffset(): ?int { |
100 | return $this->endOffset; |
101 | } |
102 | |
103 | /** |
104 | * @since 0.1.10 |
105 | * @param int|null $endOffset |
106 | */ |
107 | public function setEndOffset( ?int $endOffset ): void { |
108 | $this->endOffset = $endOffset; |
109 | } |
110 | |
111 | /** |
112 | * @since 0.1.10 |
113 | * @return string|null |
114 | */ |
115 | public function getHash(): ?string { |
116 | return $this->hash; |
117 | } |
118 | |
119 | /** |
120 | * @since 0.1.10 |
121 | * @param string|null $hash |
122 | */ |
123 | public function setHash( ?string $hash ): void { |
124 | $this->hash = $hash; |
125 | } |
126 | |
127 | } |