Total Complexity | 5 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
13 | class Synonyms |
||
14 | { |
||
15 | use Configurable; |
||
16 | |||
17 | /** |
||
18 | * @var array Synonym list |
||
19 | */ |
||
20 | protected static $synonyms; |
||
21 | |||
22 | /** |
||
23 | * Make the UK to US spelling synonyms as a newline separated string |
||
24 | * Or any other synonyms defined if the user wishes to do so |
||
25 | * @param bool $defaults add Default UK-US synonyms to the list |
||
26 | * @return string |
||
27 | */ |
||
28 | 28 | public static function getSynonymsAsString($defaults = true) |
|
29 | { |
||
30 | 28 | $result = []; |
|
31 | 28 | foreach (static::getSynonyms($defaults) as $synonym) { |
|
32 | 28 | $result[] = implode(',', $synonym); |
|
33 | } |
||
34 | |||
35 | 28 | return implode(PHP_EOL, $result) . PHP_EOL; |
|
36 | } |
||
37 | |||
38 | /** |
||
39 | * Get the available synonyms as an array from config |
||
40 | * Defaulting to adding the UK to US spelling differences |
||
41 | * @param bool $defaults adds the UK to US spelling to the list if true |
||
42 | * @return array |
||
43 | */ |
||
44 | 29 | public static function getSynonyms($defaults = true) |
|
51 | } |
||
52 | } |
||
53 |