Lines
100.00%
14 / 14
Methods
100.00%
2 / 2
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| toSortableString | 100.00% | 11 / 11 | 100.00% | 1 / 1 | 1 | ||
| toSortedCsv | 100.00% | 3 / 3 | 100.00% | 1 / 1 | 1 | ||
| 8 | class Sorter | |
| 9 | { | |
| 10 | /** | |
| 11 | * @todo check against ISO definition | |
| 12 | */ | |
| 13 | public static function toSortableString(string $string): string | |
| 14 | { | |
| 15 | $string = strtr($string, array( | |
| 16 | 'Ä' => 'Ae', | |
| 17 | 'Ö' => 'Oe', | |
| 18 | 'Ü' => 'Ue', | |
| 19 | 'ä' => 'ae', | |
| 20 | 'ö' => 'oe', | |
| 21 | 'ü' => 'ue', | |
| 22 | 'ß' => 'ss', | |
| 23 | '€' => 'E', | |
| 24 | )); | |
| 25 | return $string; | |
| 26 | } | |
| 27 | ||
| 28 | public static function toSortedCsv(mixed $csvString): string | |
| 29 | { | |
| 30 | $csvElements = explode(',', $csvString ?? ''); | |
| 31 | sort($csvElements); | |
| 32 | return implode(',', $csvElements); | |
| 33 | } | |
| 34 | } |