Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
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 | * Translates numeric values to written text in different forms. |
13 | * |
14 | * @since 0.1.10 |
15 | */ |
16 | interface DigitsToWords { |
17 | |
18 | /** |
19 | * Translate integer to ordinal text value, e.g. 1 -> 'first', 2 -> 'second'. |
20 | * |
21 | * @since 0.1.10 |
22 | * @param int $input |
23 | * @return string|null Null if input number is not supported |
24 | */ |
25 | public function intToOrdinal( int $input ): ?string; |
26 | |
27 | /** |
28 | * Translate floating point to text value, e.g. 3.1415 -> 'three point one four one five'. |
29 | * There are limitations to this method due to PHP transforming 3.00 to 3. |
30 | * |
31 | * @see DigitsToWords::stringFloatToWords() To avoid limitations of PHP. |
32 | * @since 0.1.10 |
33 | * @param float $input |
34 | * @return string|null Null if input number is not supported |
35 | */ |
36 | public function floatToWords( float $input ): ?string; |
37 | |
38 | /** |
39 | * Translate floating point to text value, e.g. 3.00 -> 'three point zero zero'. |
40 | * |
41 | * @since 0.1.10 |
42 | * @param int $integer Integer part of the floating value |
43 | * @param string|null $decimals Decimals part of the floating value as string value |
44 | * @return string|null Null if input number is not supported |
45 | */ |
46 | public function stringFloatToWords( |
47 | int $integer, |
48 | ?string $decimals = null |
49 | ): ?string; |
50 | |
51 | /** |
52 | * Translate integer to text value, e.g. 1 -> 'one', 13 -> 'thirteen'. |
53 | * |
54 | * @todo This does not support for leading zeros. 007 will be transformed to "seven". |
55 | * In order to implement, introduce new function stringIntToWords. |
56 | * @since 0.1.10 |
57 | * @param int $input |
58 | * @return string|null Null if input value is not supported. |
59 | */ |
60 | public function intToWords( int $input ): ?string; |
61 | |
62 | } |