Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
92.86% |
26 / 28 |
|
90.48% |
19 / 21 |
CRAP | |
0.00% |
0 / 1 |
| Utterance | |
92.86% |
26 / 28 |
|
90.48% |
19 / 21 |
21.16 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
1 | |||
| getUtteranceId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setUtteranceId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getAudio | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setAudio | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getSynthesisMetadata | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setSynthesisMetadata | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getRemoteWikiHash | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setRemoteWikiHash | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getPageId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setPageId | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getMessageKey | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setMessageKey | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getLanguage | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setLanguage | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getVoice | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setVoice | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getSegmentHash | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setSegmentHash | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getDateStored | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| setDateStored | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Wikispeech\Utterance; |
| 4 | |
| 5 | /** |
| 6 | * @file |
| 7 | * @ingroup Extensions |
| 8 | * @license GPL-2.0-or-later |
| 9 | */ |
| 10 | |
| 11 | use MWTimestamp; |
| 12 | |
| 13 | /** |
| 14 | * @since 0.1.10 |
| 15 | */ |
| 16 | class Utterance { |
| 17 | |
| 18 | /** @var int */ |
| 19 | private $utteranceId; |
| 20 | |
| 21 | /** @var string|null Hash from parts of URL to the wiki containing page segment of this utterance. */ |
| 22 | private $remoteWikiHash; |
| 23 | |
| 24 | /** @var int Mediawiki page ID. */ |
| 25 | private $pageId; |
| 26 | |
| 27 | /** @var string Message key */ |
| 28 | private $messageKey; |
| 29 | |
| 30 | /** @var string ISO 639 */ |
| 31 | private $language; |
| 32 | |
| 33 | /** @var string Name of synthesis voice. */ |
| 34 | private $voice; |
| 35 | |
| 36 | /** @var string Hash of segment representing utterance. */ |
| 37 | private $segmentHash; |
| 38 | |
| 39 | /** @var MWTimestamp */ |
| 40 | private $dateStored; |
| 41 | |
| 42 | /** @var string Base64 encoded audio file */ |
| 43 | private $audio; |
| 44 | |
| 45 | /** @var string JSON containing tokens etc describing the audio. */ |
| 46 | private $synthesisMetadata; |
| 47 | |
| 48 | /** |
| 49 | * @since 0.1.13 |
| 50 | * @param int $utteranceId |
| 51 | * @param string|null $remoteWikiHash |
| 52 | * @param string|null $messageKey |
| 53 | * @param int $pageId |
| 54 | * @param string $language |
| 55 | * @param string $voice |
| 56 | * @param string $segmentHash |
| 57 | * @param MWTimestamp $dateStored |
| 58 | */ |
| 59 | public function __construct( |
| 60 | int $utteranceId, |
| 61 | ?string $remoteWikiHash, |
| 62 | ?string $messageKey, |
| 63 | int $pageId, |
| 64 | string $language, |
| 65 | string $voice, |
| 66 | string $segmentHash, |
| 67 | MWTimestamp $dateStored |
| 68 | ) { |
| 69 | $this->utteranceId = $utteranceId; |
| 70 | $this->remoteWikiHash = $remoteWikiHash; |
| 71 | $this->messageKey = $messageKey; |
| 72 | $this->pageId = $pageId; |
| 73 | $this->language = $language; |
| 74 | $this->voice = $voice; |
| 75 | $this->segmentHash = $segmentHash; |
| 76 | $this->dateStored = $dateStored; |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * @since 0.1.10 |
| 81 | * @return int |
| 82 | */ |
| 83 | public function getUtteranceId(): int { |
| 84 | return $this->utteranceId; |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * @since 0.1.10 |
| 89 | * @param int $utteranceId |
| 90 | */ |
| 91 | public function setUtteranceId( int $utteranceId ): void { |
| 92 | $this->utteranceId = $utteranceId; |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * @since 0.1.10 |
| 97 | * @return string|null |
| 98 | */ |
| 99 | public function getAudio(): ?string { |
| 100 | return $this->audio; |
| 101 | } |
| 102 | |
| 103 | /** |
| 104 | * @since 0.1.10 |
| 105 | * @param string $audio |
| 106 | */ |
| 107 | public function setAudio( string $audio ): void { |
| 108 | $this->audio = $audio; |
| 109 | } |
| 110 | |
| 111 | /** |
| 112 | * @since 0.1.10 |
| 113 | * @return string|null |
| 114 | */ |
| 115 | public function getSynthesisMetadata(): ?string { |
| 116 | return $this->synthesisMetadata; |
| 117 | } |
| 118 | |
| 119 | /** |
| 120 | * @since 0.1.10 |
| 121 | * @param string $synthesisMetadata |
| 122 | */ |
| 123 | public function setSynthesisMetadata( string $synthesisMetadata ): void { |
| 124 | $this->synthesisMetadata = $synthesisMetadata; |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * @since 0.1.10 |
| 129 | * @return string|null |
| 130 | */ |
| 131 | public function getRemoteWikiHash(): ?string { |
| 132 | return $this->remoteWikiHash; |
| 133 | } |
| 134 | |
| 135 | /** |
| 136 | * @since 0.1.10 |
| 137 | * @param string|null $remoteWikiHash |
| 138 | */ |
| 139 | public function setRemoteWikiHash( ?string $remoteWikiHash ): void { |
| 140 | $this->remoteWikiHash = $remoteWikiHash; |
| 141 | } |
| 142 | |
| 143 | /** |
| 144 | * @since 0.1.10 |
| 145 | * @return int |
| 146 | */ |
| 147 | public function getPageId(): int { |
| 148 | return $this->pageId; |
| 149 | } |
| 150 | |
| 151 | /** |
| 152 | * @since 0.1.10 |
| 153 | * @param int $pageId |
| 154 | */ |
| 155 | public function setPageId( int $pageId ): void { |
| 156 | $this->pageId = $pageId; |
| 157 | } |
| 158 | |
| 159 | /** |
| 160 | * @since 0.1.13 |
| 161 | * @return string |
| 162 | */ |
| 163 | public function getMessageKey(): string { |
| 164 | return $this->messageKey; |
| 165 | } |
| 166 | |
| 167 | /** |
| 168 | * @since 0.1.13 |
| 169 | * @return string |
| 170 | */ |
| 171 | public function setMessageKey(): string { |
| 172 | return $this->messageKey; |
| 173 | } |
| 174 | |
| 175 | /** |
| 176 | * @since 0.1.10 |
| 177 | * @return string |
| 178 | */ |
| 179 | public function getLanguage(): string { |
| 180 | return $this->language; |
| 181 | } |
| 182 | |
| 183 | /** |
| 184 | * @since 0.1.10 |
| 185 | * @param string $language |
| 186 | */ |
| 187 | public function setLanguage( string $language ): void { |
| 188 | $this->language = $language; |
| 189 | } |
| 190 | |
| 191 | /** |
| 192 | * @since 0.1.10 |
| 193 | * @return string |
| 194 | */ |
| 195 | public function getVoice(): string { |
| 196 | return $this->voice; |
| 197 | } |
| 198 | |
| 199 | /** |
| 200 | * @since 0.1.10 |
| 201 | * @param string $voice |
| 202 | */ |
| 203 | public function setVoice( string $voice ): void { |
| 204 | $this->voice = $voice; |
| 205 | } |
| 206 | |
| 207 | /** |
| 208 | * @since 0.1.10 |
| 209 | * @return string |
| 210 | */ |
| 211 | public function getSegmentHash(): string { |
| 212 | return $this->segmentHash; |
| 213 | } |
| 214 | |
| 215 | /** |
| 216 | * @since 0.1.10 |
| 217 | * @param string $segmentHash |
| 218 | */ |
| 219 | public function setSegmentHash( string $segmentHash ): void { |
| 220 | $this->segmentHash = $segmentHash; |
| 221 | } |
| 222 | |
| 223 | /** |
| 224 | * @since 0.1.10 |
| 225 | * @return MWTimestamp |
| 226 | */ |
| 227 | public function getDateStored(): MWTimestamp { |
| 228 | return $this->dateStored; |
| 229 | } |
| 230 | |
| 231 | /** |
| 232 | * @since 0.1.10 |
| 233 | * @param MWTimestamp $dateStored |
| 234 | */ |
| 235 | public function setDateStored( MWTimestamp $dateStored ): void { |
| 236 | $this->dateStored = $dateStored; |
| 237 | } |
| 238 | |
| 239 | } |