Total Complexity | 12 |
Total Lines | 59 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
7 | class Gender implements \Validate\Contracts\Validate |
||
8 | { |
||
9 | use FakeNameTrait; |
||
10 | |||
11 | public static $toMale = [ |
||
12 | 'MASCULINO', |
||
13 | 'HOMEM', |
||
14 | 'MALE', |
||
15 | 'MACHO' |
||
16 | ]; |
||
17 | public static $toWoman = [ |
||
18 | 'FEMININO', |
||
19 | 'MULHER', |
||
20 | 'WOMAN', |
||
21 | 'FEMIA' |
||
22 | ]; |
||
23 | |||
24 | public static function toDatabase($gender) |
||
25 | { |
||
26 | return substr(((string) self::filter(strtoupper(preg_replace('/[^A-z]/', '',$gender)))), 0, 1); |
||
27 | } |
||
28 | |||
29 | public static function filter($gender) { |
||
37 | } |
||
38 | |||
39 | public static function toUser($gender) |
||
40 | { |
||
41 | if($gender == 'M') { |
||
42 | return 'Masculino'; |
||
43 | } |
||
44 | |||
45 | if($gender == 'F') { |
||
46 | return 'Feminino'; |
||
47 | } |
||
48 | |||
49 | return 'Unissex'; |
||
50 | } |
||
51 | |||
52 | public static function validate($gender) |
||
61 | } |
||
62 | |||
63 | public static function isSame(string $to, string $from) |
||
69 |