Conditions | 3 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8245 | public static function str_sort(string $str, bool $unique = false, bool $desc = false): string |
||
8246 | { |
||
8247 | 2 | $array = self::codepoints($str); |
|
8248 | |||
8249 | 2 | if ($unique) { |
|
8250 | 2 | $array = \array_flip(\array_flip($array)); |
|
8251 | } |
||
8252 | |||
8253 | 2 | if ($desc) { |
|
8254 | 2 | \arsort($array); |
|
8255 | } else { |
||
8256 | 2 | \asort($array); |
|
8257 | } |
||
8258 | |||
8259 | 2 | return self::string($array); |
|
8260 | } |
||
14700 |