Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 9 |
|
0.00% |
0 / 7 |
CRAP | |
0.00% |
0 / 1 |
| FilterPart | |
0.00% |
0 / 9 |
|
0.00% |
0 / 7 |
56 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| getText | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setText | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getAlias | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setAlias | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getAppliedRule | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setAppliedRule | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Wikispeech\Segment\TextFilter; |
| 4 | |
| 5 | /** |
| 6 | * @file |
| 7 | * @ingroup Extensions |
| 8 | * @license GPL-2.0-or-later |
| 9 | */ |
| 10 | |
| 11 | /** |
| 12 | * A snippet of text (could be the complete text) that may or may not have been transformed |
| 13 | * to a new text alias using a {@link FilterRule}. |
| 14 | * |
| 15 | * In the end, this represents an SSML <sub/> node. |
| 16 | * |
| 17 | * @since 0.1.10 |
| 18 | */ |
| 19 | class FilterPart { |
| 20 | |
| 21 | /** @var string */ |
| 22 | private $text; |
| 23 | |
| 24 | /** @var string|null */ |
| 25 | private $alias; |
| 26 | |
| 27 | /** @var FilterRule|null */ |
| 28 | private $appliedRule; |
| 29 | |
| 30 | /** |
| 31 | * @since 0.1.10 |
| 32 | * @param string $text |
| 33 | * @param string|null $alias |
| 34 | * @param FilterRule|null $rule |
| 35 | */ |
| 36 | public function __construct( |
| 37 | string $text, |
| 38 | ?string $alias = null, |
| 39 | ?FilterRule $rule = null |
| 40 | ) { |
| 41 | $this->text = $text; |
| 42 | $this->alias = $alias; |
| 43 | $this->appliedRule = $rule; |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * @since 0.1.10 |
| 48 | * @return string |
| 49 | */ |
| 50 | public function getText(): string { |
| 51 | return $this->text; |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * @since 0.1.10 |
| 56 | * @param string $text |
| 57 | */ |
| 58 | public function setText( string $text ): void { |
| 59 | $this->text = $text; |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * @since 0.1.10 |
| 64 | * @return string|null |
| 65 | */ |
| 66 | public function getAlias(): ?string { |
| 67 | return $this->alias; |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * @since 0.1.10 |
| 72 | * @param string|null $alias |
| 73 | */ |
| 74 | public function setAlias( ?string $alias ): void { |
| 75 | $this->alias = $alias; |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * @since 0.1.10 |
| 80 | * @return FilterRule|null |
| 81 | */ |
| 82 | public function getAppliedRule(): ?FilterRule { |
| 83 | return $this->appliedRule; |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * @since 0.1.10 |
| 88 | * @param FilterRule|null $appliedRule |
| 89 | */ |
| 90 | public function setAppliedRule( ?FilterRule $appliedRule ): void { |
| 91 | $this->appliedRule = $appliedRule; |
| 92 | } |
| 93 | |
| 94 | } |