Conditions | 1 |
Paths | 1 |
Total Lines | 112 |
Code Lines | 105 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
43 | public function values(string $sex = 'U'): array |
||
44 | { |
||
45 | $values = [ |
||
46 | 'M' => [ |
||
47 | '' => '', |
||
48 | 'attendant' => I18N::translateContext('MALE', 'Attendant'), |
||
49 | 'attending' => I18N::translateContext('MALE', 'Attending'), |
||
50 | 'best_man' => I18N::translate('Best man'), |
||
51 | 'bridesmaid' => I18N::translate('Bridesmaid'), |
||
52 | 'buyer' => I18N::translateContext('MALE', 'Buyer'), |
||
53 | 'circumciser' => I18N::translate('Circumciser'), |
||
54 | 'civil_registrar' => I18N::translateContext('MALE', 'Civil registrar'), |
||
55 | 'employee' => I18N::translateContext('MALE', 'Employee'), |
||
56 | 'employer' => I18N::translateContext('MALE', 'Employer'), |
||
57 | 'foster_child' => I18N::translate('Foster child'), |
||
58 | 'foster_father' => I18N::translate('Foster father'), |
||
59 | 'foster_mother' => I18N::translate('Foster mother'), |
||
60 | 'friend' => I18N::translateContext('MALE', 'Friend'), |
||
61 | 'godfather' => I18N::translate('Godfather'), |
||
62 | 'godmother' => I18N::translate('Godmother'), |
||
63 | 'godparent' => I18N::translate('Godparent'), |
||
64 | 'godson' => I18N::translate('Godson'), |
||
65 | 'goddaughter' => I18N::translate('Goddaughter'), |
||
66 | 'godchild' => I18N::translate('Godchild'), |
||
67 | 'guardian' => I18N::translateContext('MALE', 'Guardian'), |
||
68 | 'informant' => I18N::translateContext('MALE', 'Informant'), |
||
69 | 'lodger' => I18N::translateContext('MALE', 'Lodger'), |
||
70 | 'nanny' => I18N::translate('Nanny'), |
||
71 | 'nurse' => I18N::translateContext('MALE', 'Nurse'), |
||
72 | 'owner' => I18N::translateContext('MALE', 'Owner'), |
||
73 | 'priest' => I18N::translate('Priest'), |
||
74 | 'rabbi' => I18N::translate('Rabbi'), |
||
75 | 'registry_officer' => I18N::translateContext('MALE', 'Registry officer'), |
||
76 | 'seller' => I18N::translateContext('MALE', 'Seller'), |
||
77 | 'servant' => I18N::translateContext('MALE', 'Servant'), |
||
78 | 'slave' => I18N::translateContext('MALE', 'Slave'), |
||
79 | 'ward' => I18N::translateContext('MALE', 'Ward'), |
||
80 | 'witness' => I18N::translate('Witness'), |
||
81 | ], |
||
82 | 'F' => [ |
||
83 | 'attendant' => I18N::translateContext('FEMALE', 'Attendant'), |
||
84 | 'attending' => I18N::translateContext('FEMALE', 'Attending'), |
||
85 | 'best_man' => I18N::translate('Best man'), |
||
86 | 'bridesmaid' => I18N::translate('Bridesmaid'), |
||
87 | 'buyer' => I18N::translateContext('FEMALE', 'Buyer'), |
||
88 | 'circumciser' => I18N::translate('Circumciser'), |
||
89 | 'civil_registrar' => I18N::translateContext('FEMALE', 'Civil registrar'), |
||
90 | 'employee' => I18N::translateContext('FEMALE', 'Employee'), |
||
91 | 'employer' => I18N::translateContext('FEMALE', 'Employer'), |
||
92 | 'foster_child' => I18N::translate('Foster child'), |
||
93 | 'foster_father' => I18N::translate('Foster father'), |
||
94 | 'foster_mother' => I18N::translate('Foster mother'), |
||
95 | 'friend' => I18N::translateContext('FEMALE', 'Friend'), |
||
96 | 'godfather' => I18N::translate('Godfather'), |
||
97 | 'godmother' => I18N::translate('Godmother'), |
||
98 | 'godparent' => I18N::translate('Godparent'), |
||
99 | 'godson' => I18N::translate('Godson'), |
||
100 | 'goddaughter' => I18N::translate('Goddaughter'), |
||
101 | 'godchild' => I18N::translate('Godchild'), |
||
102 | 'guardian' => I18N::translateContext('FEMALE', 'Guardian'), |
||
103 | 'informant' => I18N::translateContext('FEMALE', 'Informant'), |
||
104 | 'lodger' => I18N::translateContext('FEMALE', 'Lodger'), |
||
105 | 'nanny' => I18N::translate('Nanny'), |
||
106 | 'nurse' => I18N::translateContext('FEMALE', 'Nurse'), |
||
107 | 'owner' => I18N::translateContext('FEMALE', 'Owner'), |
||
108 | 'priest' => I18N::translate('Priest'), |
||
109 | 'rabbi' => I18N::translate('Rabbi'), |
||
110 | 'registry_officer' => I18N::translateContext('FEMALE', 'Registry officer'), |
||
111 | 'seller' => I18N::translateContext('FEMALE', 'Seller'), |
||
112 | 'servant' => I18N::translateContext('FEMALE', 'Servant'), |
||
113 | 'slave' => I18N::translateContext('FEMALE', 'Slave'), |
||
114 | 'ward' => I18N::translateContext('FEMALE', 'Ward'), |
||
115 | 'witness' => I18N::translate('Witness'), |
||
116 | ], |
||
117 | 'U' => [ |
||
118 | 'attendant' => I18N::translate('Attendant'), |
||
119 | 'attending' => I18N::translate('Attending'), |
||
120 | 'best_man' => I18N::translate('Best man'), |
||
121 | 'bridesmaid' => I18N::translate('Bridesmaid'), |
||
122 | 'buyer' => I18N::translate('Buyer'), |
||
123 | 'circumciser' => I18N::translate('Circumciser'), |
||
124 | 'civil_registrar' => I18N::translate('Civil registrar'), |
||
125 | 'employee' => I18N::translate('Employee'), |
||
126 | 'employer' => I18N::translate('Employer'), |
||
127 | 'foster_child' => I18N::translate('Foster child'), |
||
128 | 'foster_father' => I18N::translate('Foster father'), |
||
129 | 'foster_mother' => I18N::translate('Foster mother'), |
||
130 | 'friend' => I18N::translate('Friend'), |
||
131 | 'godfather' => I18N::translate('Godfather'), |
||
132 | 'godmother' => I18N::translate('Godmother'), |
||
133 | 'godparent' => I18N::translate('Godparent'), |
||
134 | 'godson' => I18N::translate('Godson'), |
||
135 | 'goddaughter' => I18N::translate('Goddaughter'), |
||
136 | 'godchild' => I18N::translate('Godchild'), |
||
137 | 'guardian' => I18N::translate('Guardian'), |
||
138 | 'informant' => I18N::translate('Informant'), |
||
139 | 'lodger' => I18N::translate('Lodger'), |
||
140 | 'nanny' => I18N::translate('Nanny'), |
||
141 | 'nurse' => I18N::translate('Nurse'), |
||
142 | 'owner' => I18N::translate('Owner'), |
||
143 | 'priest' => I18N::translate('Priest'), |
||
144 | 'rabbi' => I18N::translate('Rabbi'), |
||
145 | 'registry_officer' => I18N::translate('Registry officer'), |
||
146 | 'seller' => I18N::translate('Seller'), |
||
147 | 'servant' => I18N::translate('Servant'), |
||
148 | 'slave' => I18N::translate('Slave'), |
||
149 | 'ward' => I18N::translate('Ward'), |
||
150 | 'witness' => I18N::translate('Witness'), |
||
151 | ], |
||
152 | ]; |
||
153 | |||
154 | return $values[$sex] ?? $values['U']; |
||
155 | } |
||
157 |