| Total Complexity | 13 |
| Total Lines | 97 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | final class Sorter |
||
| 8 | { |
||
| 9 | protected $special_chars = [ |
||
| 10 | ' ', |
||
| 11 | '*', |
||
| 12 | '-', |
||
| 13 | '_', |
||
| 14 | '=', |
||
| 15 | '\\', |
||
| 16 | '/', |
||
| 17 | '|', |
||
| 18 | '~', |
||
| 19 | '`', |
||
| 20 | '+', |
||
| 21 | ':', |
||
| 22 | ';', |
||
| 23 | '@', |
||
| 24 | '#', |
||
| 25 | '$', |
||
| 26 | '%', |
||
| 27 | '^', |
||
| 28 | '&', |
||
| 29 | '?', |
||
| 30 | '!', |
||
| 31 | '(', |
||
| 32 | ')', |
||
| 33 | '{', |
||
| 34 | '}', |
||
| 35 | '[', |
||
| 36 | ']', |
||
| 37 | '§', |
||
| 38 | '№', |
||
| 39 | '<', |
||
| 40 | '>', |
||
| 41 | '.', |
||
| 42 | ',', |
||
| 43 | ]; |
||
| 44 | |||
| 45 | /** |
||
| 46 | * Gets an array of special characters. |
||
| 47 | * |
||
| 48 | * @return string[] |
||
| 49 | */ |
||
| 50 | 12 | public function specialChars(): array |
|
| 51 | { |
||
| 52 | 12 | return $this->special_chars; |
|
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * Gets a callback function for sorting. |
||
| 57 | * |
||
| 58 | * @return callable |
||
| 59 | */ |
||
| 60 | 14 | public function defaultCallback(): callable |
|
| 79 | 14 | }; |
|
| 80 | } |
||
| 81 | |||
| 82 | /** |
||
| 83 | * Prepares a value for case-insensitive sorting. |
||
| 84 | * |
||
| 85 | * @param $value |
||
| 86 | * |
||
| 87 | * @return mixed|string|null |
||
| 88 | */ |
||
| 89 | 14 | protected function lower($value) |
|
| 92 | } |
||
| 93 | |||
| 94 | /** |
||
| 95 | * Determine if a value is a special character. |
||
| 96 | * |
||
| 97 | * @param $value |
||
| 98 | * |
||
| 99 | * @return bool |
||
| 100 | */ |
||
| 101 | 8 | protected function hasSpecialChar($value): bool |
|
| 104 | } |
||
| 105 | } |
||
| 106 |