Lines
100.00%
5 / 5
Methods
100.00%
2 / 2
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| fromQuery | 100.00% | 4 / 4 | 100.00% | 1 / 1 | 3 | ||
| toQuery | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| 10 | class ExcludeIds | |
| 11 | { | |
| 12 | public static function fromQuery(?string $exclude): array | |
| 13 | { | |
| 14 | if ($exclude === null || $exclude === '') { | |
| 15 | return []; | |
| 16 | } | |
| 17 | ||
| 18 | $ids = array_map('trim', explode(',', $exclude)); | |
| 19 | return array_values(array_filter($ids, static fn(string $id): bool => $id !== '')); | |
| 20 | } | |
| 21 | ||
| 22 | public static function toQuery(array $exclude): string | |
| 23 | { | |
| 24 | return implode(',', $exclude); | |
| 25 | } | |
| 26 | } |