Conditions | 4 |
Paths | 1 |
Total Lines | 157 |
Code Lines | 125 |
Lines | 0 |
Ratio | 0 % |
Changes | 5 | ||
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 |
||
61 | public function relationships(): array |
||
62 | { |
||
63 | $genitive = static fn (string $prefix, string $suffix, string $gender): array => [ |
||
64 | $prefix . $suffix, |
||
65 | '%s ' . ($gender === 'M' ? 'des ' . $prefix . 's' : '%s der ' . $prefix) . $suffix, |
||
66 | ] ; |
||
67 | |||
68 | // $n <= -1 -> '' |
||
69 | // $n == 0 -> Ur |
||
70 | // $n == 1 -> Urur |
||
71 | // $n >= 2 -> $n+1 ' x Ur' |
||
72 | $ur = static fn (int $n, string $simpleGreat, string $suffix, string $gender): array => $genitive( |
||
73 | (($n > 1) ? ($n + 1) . ' x Ur' : (($n > -1) ? 'Ur' . str_repeat('ur', $n) : '')) . $simpleGreat, |
||
74 | $suffix, |
||
75 | $gender |
||
76 | ); |
||
77 | |||
78 | return [ |
||
79 | // Adopted |
||
80 | Relationship::fixed('Adoptivmutter', '%s der Adoptivmutter')->adoptive()->mother(), |
||
81 | Relationship::fixed('Adoptivvater', '%s des Adoptivvaters')->adoptive()->father(), |
||
82 | Relationship::fixed('Adoptiveltern', '%s der Adoptiveltern')->adoptive()->parent(), |
||
83 | Relationship::fixed('Adoptivtochter', '%s der Adoptivtochter')->adopted()->daughter(), |
||
84 | Relationship::fixed('Adoptivsohn', '%s des Adoptivsohnes')->adopted()->son(), |
||
85 | Relationship::fixed('Adoptivkind', '%s des Adoptivkindes')->adopted()->child(), |
||
86 | // Fostered |
||
87 | Relationship::fixed('Pflegemutter', '%s der Pflegemutter')->fostering()->mother(), |
||
88 | Relationship::fixed('Pflegevater', '%s des Pflegevaters')->fostering()->father(), |
||
89 | Relationship::fixed('Pflegeeltern', '%s der Pflegeeltern')->fostering()->parent(), |
||
90 | Relationship::fixed('Pflegetochter', '%s der Pflegetochter')->fostered()->daughter(), |
||
91 | Relationship::fixed('Pflegesohn', '%s des Pflegesohnes')->fostered()->son(), |
||
92 | Relationship::fixed('Pflegekind', '%s des Pflegekindes')->fostered()->child(), |
||
93 | // Parents |
||
94 | Relationship::fixed('Mutter', '%s der Mutter')->mother(), |
||
95 | Relationship::fixed('Vater', '%s des Vaters')->father(), |
||
96 | Relationship::fixed('Elternteil', '%s der Eltern')->parent(), |
||
97 | // Children |
||
98 | Relationship::fixed('Tochter', '%s der Tochter')->daughter(), |
||
99 | Relationship::fixed('Sohn', '%s des Sohnes')->son(), |
||
100 | Relationship::fixed('Kind', '%s des Kindes')->child(), |
||
101 | // Siblings |
||
102 | Relationship::fixed('Zwillingsschwester', '%s der Zwillingsschwester')->twin()->sister(), |
||
103 | Relationship::fixed('Zwillingsbruder', '%s des Zwillingsbruders')->twin()->brother(), |
||
104 | Relationship::fixed('Zwillingsgeschwister', '%s des Zwillingsgeschwisters')->twin()->sibling(), |
||
105 | Relationship::fixed('Ältere Schwester', '%s der älterer Schwester')->older()->sister(), |
||
106 | Relationship::fixed('Älterer Bruder', '%s des älteren Bruders')->older()->brother(), |
||
107 | Relationship::fixed('Älteres Geschwister', '%s des älteren Geschwisters')->older()->sibling(), |
||
108 | Relationship::fixed('Jüngere Schwester', '%s der jüngeren Schwester')->younger()->sister(), |
||
109 | Relationship::fixed('Jüngerer Bruder', '%s des jüngeren Bruders')->younger()->brother(), |
||
110 | Relationship::fixed('Jüngeres Geschwister', '%s des jüngeres Geschwisters')->younger()->sibling(), |
||
111 | Relationship::fixed('Schwester', '%s der Schwester')->sister(), |
||
112 | Relationship::fixed('Bruder', '%s des Bruders')->brother(), |
||
113 | Relationship::fixed('Geschwister', '%s der Geschwister')->sibling(), |
||
114 | // Half-siblings |
||
115 | Relationship::fixed('Halbschwester', '%s der Halbschwester')->parent()->daughter(), |
||
116 | Relationship::fixed('Halbbruder', '%s des Halbbruders')->parent()->son(), |
||
117 | Relationship::fixed('Halbgeschwister', '%s der Halbgeschwister')->parent()->child(), |
||
118 | // Stepfamily |
||
119 | Relationship::fixed('Stiefmutter', '%s der Stiefmutter')->parent()->wife(), |
||
120 | Relationship::fixed('Stiefvater', '%s des Stiefvaters')->parent()->husband(), |
||
121 | Relationship::fixed('Stiefelternteil', '%s des Stiefelternteils')->parent()->married()->spouse(), |
||
122 | Relationship::fixed('Stieftochter', '%s der Stieftochter')->married()->spouse()->daughter(), |
||
123 | Relationship::fixed('Stiefsohn', '%s des Stiefsohnes')->married()->spouse()->son(), |
||
124 | Relationship::fixed('Stiefkind', '%s des Stiefkindes')->married()->spouse()->child(), |
||
125 | Relationship::fixed('Stiefschwester', '%s der Stiefschwester')->parent()->spouse()->daughter(), |
||
126 | Relationship::fixed('Stiefbruder', '%s des Stiefbruders')->parent()->spouse()->son(), |
||
127 | Relationship::fixed('Stiefgeschwister', '%s der Stiefgeschwister')->parent()->spouse()->child(), |
||
128 | // Cousin / Cousine |
||
129 | Relationship::fixed('Cousine', '%s der Cousine')->parent()->sister()->child()->female(), |
||
130 | Relationship::fixed('Cousine', '%s der Cousine')->parent()->brother()->child()->female(), |
||
131 | Relationship::fixed('Cousin', '%s des Cousins')->parent()->sister()->child()->male(), |
||
132 | Relationship::fixed('Cousin', '%s des Cousins')->parent()->brother()->child()->male(), |
||
133 | // Partners |
||
134 | Relationship::fixed('Ex-Frau', '%s der Ex-Frau')->divorced()->partner()->female(), |
||
135 | Relationship::fixed('Ex-Mann', '%s des Ex-Mannes')->divorced()->partner()->male(), |
||
136 | Relationship::fixed('Ex-Ehepartner', '%s des Ex-Ehepartners')->divorced()->partner(), |
||
137 | Relationship::fixed('Verlobte', '%s der Verlobten')->engaged()->partner()->female(), |
||
138 | Relationship::fixed('Verlobter', '%s des Verlobten')->engaged()->partner()->male(), |
||
139 | Relationship::fixed('Ehefrau', '%s der Ehefrau')->wife(), |
||
140 | Relationship::fixed('Ehemann', '%s des Ehemannes')->husband(), |
||
141 | Relationship::fixed('Ehepartner', '%s des Ehepartners')->spouse(), |
||
142 | Relationship::fixed('Partner', '%s des Partners')->partner(), |
||
143 | // In-laws |
||
144 | Relationship::fixed('Schwiegermutter', '%s der Schwiegermutter')->married()->spouse()->mother(), |
||
145 | Relationship::fixed('Schwiegervater', '%s des Schwiegervaters')->married()->spouse()->father(), |
||
146 | Relationship::fixed('Schwiegereltern', '%s der Schwiegereltern')->married()->spouse()->parent(), |
||
147 | Relationship::fixed('Schwiegertochter', '%s der Schwiegertochter')->child()->wife(), |
||
148 | Relationship::fixed('Schwiegersohn', '%s des Schwiegersohnes')->child()->husband(), |
||
149 | Relationship::fixed('Schwiegerkind', '%s des Schwiegerkindes')->child()->married()->spouse(), |
||
150 | // |
||
151 | Relationship::fixed('Schwägerin', '%s der Schwägerin')->sibling()->spouse()->sister(), |
||
152 | Relationship::fixed('Schwager', '%s des Schwagers')->sibling()->spouse()->brother(), |
||
153 | Relationship::fixed('Schwager/Schwägerin', '%s des Schwagers / der Schwägerin')->sibling()->spouse()->sibling(), |
||
154 | Relationship::fixed('Schwägerin', '%s der Schwägerin')->spouse()->sister(), |
||
155 | Relationship::fixed('Schwager', '%s des Schwagers')->spouse()->brother(), |
||
156 | Relationship::fixed('Schwager/Schwägerin', '%s des Schwagers / der Schwägerin')->spouse()->sibling(), |
||
157 | Relationship::fixed('Schwägerin', '%s der Schwägerin')->sibling()->wife(), |
||
158 | Relationship::fixed('Schwager', '%s des Schwagers')->sibling()->husband(), |
||
159 | Relationship::fixed('Schwager/Schwägerin', '%s des Schwagers / der Schwägerin')->sibling()->spouse(), |
||
160 | // Grandparents |
||
161 | Relationship::fixed('Großmutter mütterlicherseits', '%s der Großmutter (mütterlicherseits)')->mother()->mother(), |
||
162 | Relationship::fixed('Großvater mütterlicherseits', '%s des Großvaters (mütterlicherseits)')->mother()->father(), |
||
163 | Relationship::fixed('Großeltern mütterlicherseits', '%s der Großeltern (mütterlicherseits)')->mother()->parent(), |
||
164 | Relationship::fixed('Großmutter väterlicherseits', '%s der Großmutter (väterlicherseits)')->father()->mother(), |
||
165 | Relationship::fixed('Großvater väterlicherseits', '%s des Großvaters (väterlicherseits)')->father()->father(), |
||
166 | Relationship::fixed('Großeltern väterlicherseits', '%s der Großeltern (väterlicherseits)')->father()->parent(), |
||
167 | Relationship::fixed('Großmutter', '%s der Großmutter')->parent()->mother(), |
||
168 | Relationship::fixed('Großvater', '%s des Großvaters')->parent()->father(), |
||
169 | Relationship::fixed('Großeltern', '%s der Großeltern')->parent()->parent(), |
||
170 | // Grandchildren |
||
171 | Relationship::fixed('Enkelin', '%s der Enkelin')->child()->daughter(), |
||
172 | Relationship::fixed('Enkel', '%s des Enkels')->child()->son(), |
||
173 | Relationship::fixed('Enkelin/Enkel', '%s der Enkelin/des Enkels')->child()->child(), |
||
174 | // Nichte / Neffe |
||
175 | Relationship::fixed('Nichte', '%s der Nichte')->sibling()->daughter(), |
||
176 | Relationship::fixed('Nichte', '%s der Nichte')->married()->spouse()->sibling()->daughter(), |
||
177 | Relationship::fixed('Neffe', '%s des Neffen')->sibling()->son(), |
||
178 | Relationship::fixed('Neffe', '%s des Neffen')->married()->spouse()->sibling()->son(), |
||
179 | Relationship::fixed('Nichte/Neffe', '%s der Nichte / des Neffen')->sibling()->child(), |
||
180 | Relationship::fixed('Nichte/Neffe', '%s der Nichte/ des Neffen')->married()->spouse()->sibling()->child(), |
||
181 | // Großnichte / Großneffe |
||
182 | Relationship::fixed('Großnichte', '%s der Großnichte')->sibling()->child()->child()->female(), |
||
183 | Relationship::fixed('Großnichte', '%s der Großnichte')->married()->spouse()->sibling()->child()->child()->female(), |
||
184 | Relationship::fixed('Großneffe', '%s des Großneffen')->sibling()->child()->child()->male(), |
||
185 | Relationship::fixed('Großneffe', '%s des Großneffen')->married()->spouse()->sibling()->child()->child()->male(), |
||
186 | // Tante / Onkel |
||
187 | Relationship::fixed('Tante', '%s der Tante')->parent()->sister(), |
||
188 | Relationship::fixed('Tante', '%s der Tante')->parent()->brother()->wife(), |
||
189 | Relationship::fixed('Onkel', '%s des Onkels')->parent()->sister()->husband(), |
||
190 | Relationship::fixed('Onkel', '%s des Onkels')->parent()->brother(), |
||
191 | // Großtante / Großonkel |
||
192 | Relationship::fixed('Großtante', '%s der Großtante')->parent()->parent()->sister(), |
||
193 | Relationship::fixed('Großtante', '%s der Großtante')->parent()->parent()->brother()->wife(), |
||
194 | Relationship::fixed('Großonkel', '%s des Großonkels')->parent()->parent()->brother(), |
||
195 | Relationship::fixed('Großonkel', '%s des Großonkels')->parent()->parent()->sister()->husband(), |
||
196 | // Relationships with dynamically generated names |
||
197 | // ancestors: n=2 -> Urgroßmutter (mütterlicherseits) / Großmutter der Mutter |
||
198 | Relationship::dynamic(static fn (int $n) => $ur($n - 2, 'großmutter', ' (mütterlicherseits)', 'F'))->mother()->ancestor()->female(), |
||
199 | Relationship::dynamic(static fn (int $n) => $ur($n - 2, 'großvater', ' (mütterlicherseits)', 'M'))->mother()->ancestor()->male(), |
||
200 | Relationship::dynamic(static fn (int $n) => $ur($n - 2, 'großmutter', ' (väterlicherseits)', 'F'))->father()->ancestor()->female(), |
||
201 | Relationship::dynamic(static fn (int $n) => $ur($n - 2, 'großvater', ' (väterlicherseits)', 'M'))->father()->ancestor()->male(), |
||
202 | // |
||
203 | Relationship::dynamic(static fn (int $n) => $ur($n - 2, 'großeltern', ' (väterlicherseits)', 'U'))->father()->ancestor(), |
||
204 | Relationship::dynamic(static fn (int $n) => $ur($n - 2, 'großeltern', ' (mütterlicherseits)', 'U'))->mother()->ancestor(), |
||
205 | // |
||
206 | Relationship::dynamic(static fn (int $n) => $ur($n - 3, 'großtante', '', 'F'))->ancestor()->sister(), |
||
207 | Relationship::dynamic(static fn (int $n) => $ur($n - 3, 'großtante', '', 'F'))->ancestor()->sibling()->wife(), |
||
208 | Relationship::dynamic(static fn (int $n) => $ur($n - 3, 'großonkel', '', 'M'))->ancestor()->brother(), |
||
209 | Relationship::dynamic(static fn (int $n) => $ur($n - 3, 'großonkel', '', 'M'))->ancestor()->sibling()->husband(), |
||
210 | // descendants |
||
211 | Relationship::dynamic(static fn (int $n) => $ur($n - 3, 'großnichte', '', 'F'))->sibling()->descendant()->female(), |
||
212 | Relationship::dynamic(static fn (int $n) => $ur($n - 3, 'großnichte', '', 'F'))->married()->spouse()->sibling()->descendant()->female(), |
||
213 | Relationship::dynamic(static fn (int $n) => $ur($n - 3, 'großneffe', '', 'M'))->sibling()->descendant()->male(), |
||
214 | Relationship::dynamic(static fn (int $n) => $ur($n - 3, 'großneffe', '', 'M'))->married()->spouse()->sibling()->descendant()->male(), |
||
215 | Relationship::dynamic(static fn (int $n) => $ur($n - 3, 'enkelin', '', 'F'))->descendant()->female(), |
||
216 | Relationship::dynamic(static fn (int $n) => $ur($n - 3, 'enkel', '', 'M'))->descendant()->male(), |
||
217 | Relationship::dynamic(static fn (int $n) => $ur($n - 3, 'enkelin/enkel', '', 'U'))->descendant(), |
||
218 | ]; |
||
221 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths