Total Complexity | 1 |
Total Lines | 55 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | class GeolocationDefaults extends DefaultsAbstract |
||
6 | { |
||
7 | /** |
||
8 | * The values that should be constrained after sanitization is run. |
||
9 | * This is done after $casts and $sanitize. |
||
10 | */ |
||
11 | public array $enums = [ |
||
12 | 'status' => [ |
||
13 | 'fail', 'success', |
||
14 | ], |
||
15 | ]; |
||
16 | |||
17 | /** |
||
18 | * The values that should be guarded. |
||
19 | * |
||
20 | * @var string[] |
||
21 | */ |
||
22 | public array $guarded = [ |
||
23 | 'message', 'query', 'status', |
||
24 | ]; |
||
25 | |||
26 | /** |
||
27 | * The keys that should be mapped to other keys. |
||
28 | * Keys are mapped before the values are normalized and sanitized. |
||
29 | * Note: Mapped keys should not be included in the defaults! |
||
30 | */ |
||
31 | public array $mapped = [ |
||
32 | 'continentCode' => 'continent', |
||
33 | 'countryCode' => 'country', |
||
34 | ]; |
||
35 | |||
36 | /** |
||
37 | * The values that should be sanitized. |
||
38 | * This is done after $casts and before $enums. |
||
39 | */ |
||
40 | public array $sanitize = [ |
||
41 | 'city' => 'text', |
||
42 | 'continent' => 'text', |
||
43 | 'country' => 'text', |
||
44 | 'message' => 'text', |
||
45 | 'query' => 'text', |
||
46 | 'region' => 'text', |
||
47 | 'status' => 'text', |
||
48 | ]; |
||
49 | |||
50 | protected function defaults(): array |
||
63 |