| Conditions | 4 |
| Paths | 1 |
| Total Lines | 156 |
| Code Lines | 124 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 6 | ||
| 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 | // Cousins |
||
| 129 | Relationship::fixed('Cousin', '%s des Cousins')->parent()->sibling()->son(), |
||
| 130 | Relationship::fixed('Cousine', '%s der Cousine')->parent()->sibling()->daughter(), |
||
| 131 | Relationship::fixed('Cousin/Cousine', '%s des Cousins/der Cousine')->parent()->sibling()->child(), |
||
| 132 | // Partners |
||
| 133 | Relationship::fixed('Ex-Frau', '%s der Ex-Frau')->divorced()->partner()->female(), |
||
| 134 | Relationship::fixed('Ex-Mann', '%s des Ex-Mannes')->divorced()->partner()->male(), |
||
| 135 | Relationship::fixed('Ex-Ehepartner', '%s des Ex-Ehepartners')->divorced()->partner(), |
||
| 136 | Relationship::fixed('Verlobte', '%s der Verlobten')->engaged()->partner()->female(), |
||
| 137 | Relationship::fixed('Verlobter', '%s des Verlobten')->engaged()->partner()->male(), |
||
| 138 | Relationship::fixed('Ehefrau', '%s der Ehefrau')->wife(), |
||
| 139 | Relationship::fixed('Ehemann', '%s des Ehemannes')->husband(), |
||
| 140 | Relationship::fixed('Ehepartner', '%s des Ehepartners')->spouse(), |
||
| 141 | Relationship::fixed('Partner', '%s des Partners')->partner(), |
||
| 142 | // In-laws |
||
| 143 | Relationship::fixed('Schwiegermutter', '%s der Schwiegermutter')->married()->spouse()->mother(), |
||
| 144 | Relationship::fixed('Schwiegervater', '%s des Schwiegervaters')->married()->spouse()->father(), |
||
| 145 | Relationship::fixed('Schwiegereltern', '%s der Schwiegereltern')->married()->spouse()->parent(), |
||
| 146 | Relationship::fixed('Schwiegertochter', '%s der Schwiegertochter')->child()->wife(), |
||
| 147 | Relationship::fixed('Schwiegersohn', '%s des Schwiegersohnes')->child()->husband(), |
||
| 148 | Relationship::fixed('Schwiegerkind', '%s des Schwiegerkindes')->child()->married()->spouse(), |
||
| 149 | // |
||
| 150 | Relationship::fixed('Schwägerin', '%s der Schwägerin')->sibling()->spouse()->sister(), |
||
| 151 | Relationship::fixed('Schwager', '%s des Schwagers')->sibling()->spouse()->brother(), |
||
| 152 | Relationship::fixed('Schwager/Schwägerin', '%s des Schwagers / der Schwägerin')->sibling()->spouse()->sibling(), |
||
| 153 | Relationship::fixed('Schwägerin', '%s der Schwägerin')->spouse()->sister(), |
||
| 154 | Relationship::fixed('Schwager', '%s des Schwagers')->spouse()->brother(), |
||
| 155 | Relationship::fixed('Schwager/Schwägerin', '%s des Schwagers / der Schwägerin')->spouse()->sibling(), |
||
| 156 | Relationship::fixed('Schwägerin', '%s der Schwägerin')->sibling()->wife(), |
||
| 157 | Relationship::fixed('Schwager', '%s des Schwagers')->sibling()->husband(), |
||
| 158 | Relationship::fixed('Schwager/Schwägerin', '%s des Schwagers / der Schwägerin')->sibling()->spouse(), |
||
| 159 | // Grandparents |
||
| 160 | Relationship::fixed('Großmutter mütterlicherseits', '%s der Großmutter (mütterlicherseits)')->mother()->mother(), |
||
| 161 | Relationship::fixed('Großvater mütterlicherseits', '%s des Großvaters (mütterlicherseits)')->mother()->father(), |
||
| 162 | Relationship::fixed('Großeltern mütterlicherseits', '%s der Großeltern (mütterlicherseits)')->mother()->parent(), |
||
| 163 | Relationship::fixed('Großmutter väterlicherseits', '%s der Großmutter (väterlicherseits)')->father()->mother(), |
||
| 164 | Relationship::fixed('Großvater väterlicherseits', '%s des Großvaters (väterlicherseits)')->father()->father(), |
||
| 165 | Relationship::fixed('Großeltern väterlicherseits', '%s der Großeltern (väterlicherseits)')->father()->parent(), |
||
| 166 | Relationship::fixed('Großmutter', '%s der Großmutter')->parent()->mother(), |
||
| 167 | Relationship::fixed('Großvater', '%s des Großvaters')->parent()->father(), |
||
| 168 | Relationship::fixed('Großeltern', '%s der Großeltern')->parent()->parent(), |
||
| 169 | // Grandchildren |
||
| 170 | Relationship::fixed('Enkelin', '%s der Enkelin')->child()->daughter(), |
||
| 171 | Relationship::fixed('Enkel', '%s des Enkels')->child()->son(), |
||
| 172 | Relationship::fixed('Enkelin/Enkel', '%s der Enkelin/des Enkels')->child()->child(), |
||
| 173 | // Nichte / Neffe |
||
| 174 | Relationship::fixed('Nichte', '%s der Nichte')->sibling()->daughter(), |
||
| 175 | Relationship::fixed('Nichte', '%s der Nichte')->married()->spouse()->sibling()->daughter(), |
||
| 176 | Relationship::fixed('Neffe', '%s des Neffen')->sibling()->son(), |
||
| 177 | Relationship::fixed('Neffe', '%s des Neffen')->married()->spouse()->sibling()->son(), |
||
| 178 | Relationship::fixed('Nichte/Neffe', '%s der Nichte / des Neffen')->sibling()->child(), |
||
| 179 | Relationship::fixed('Nichte/Neffe', '%s der Nichte/ des Neffen')->married()->spouse()->sibling()->child(), |
||
| 180 | // Großnichte / Großneffe |
||
| 181 | Relationship::fixed('Großnichte', '%s der Großnichte')->sibling()->child()->child()->female(), |
||
| 182 | Relationship::fixed('Großnichte', '%s der Großnichte')->married()->spouse()->sibling()->child()->child()->female(), |
||
| 183 | Relationship::fixed('Großneffe', '%s des Großneffen')->sibling()->child()->child()->male(), |
||
| 184 | Relationship::fixed('Großneffe', '%s des Großneffen')->married()->spouse()->sibling()->child()->child()->male(), |
||
| 185 | // Tante / Onkel |
||
| 186 | Relationship::fixed('Tante', '%s der Tante')->parent()->sister(), |
||
| 187 | Relationship::fixed('Tante', '%s der Tante')->parent()->brother()->wife(), |
||
| 188 | Relationship::fixed('Onkel', '%s des Onkels')->parent()->sister()->husband(), |
||
| 189 | Relationship::fixed('Onkel', '%s des Onkels')->parent()->brother(), |
||
| 190 | // Großtante / Großonkel |
||
| 191 | Relationship::fixed('Großtante', '%s der Großtante')->parent()->parent()->sister(), |
||
| 192 | Relationship::fixed('Großtante', '%s der Großtante')->parent()->parent()->brother()->wife(), |
||
| 193 | Relationship::fixed('Großonkel', '%s des Großonkels')->parent()->parent()->brother(), |
||
| 194 | Relationship::fixed('Großonkel', '%s des Großonkels')->parent()->parent()->sister()->husband(), |
||
| 195 | // Relationships with dynamically generated names |
||
| 196 | // ancestors: n=2 -> Urgroßmutter (mütterlicherseits) / Großmutter der Mutter |
||
| 197 | Relationship::dynamic(static fn (int $n) => $ur($n - 2, 'großmutter', ' (mütterlicherseits)', 'F'))->mother()->ancestor()->female(), |
||
| 198 | Relationship::dynamic(static fn (int $n) => $ur($n - 2, 'großvater', ' (mütterlicherseits)', 'M'))->mother()->ancestor()->male(), |
||
| 199 | Relationship::dynamic(static fn (int $n) => $ur($n - 2, 'großmutter', ' (väterlicherseits)', 'F'))->father()->ancestor()->female(), |
||
| 200 | Relationship::dynamic(static fn (int $n) => $ur($n - 2, 'großvater', ' (väterlicherseits)', 'M'))->father()->ancestor()->male(), |
||
| 201 | // |
||
| 202 | Relationship::dynamic(static fn (int $n) => $ur($n - 2, 'großeltern', ' (väterlicherseits)', 'U'))->father()->ancestor(), |
||
| 203 | Relationship::dynamic(static fn (int $n) => $ur($n - 2, 'großeltern', ' (mütterlicherseits)', 'U'))->mother()->ancestor(), |
||
| 204 | // |
||
| 205 | Relationship::dynamic(static fn (int $n) => $ur($n - 3, 'großtante', '', 'F'))->ancestor()->sister(), |
||
| 206 | Relationship::dynamic(static fn (int $n) => $ur($n - 3, 'großtante', '', 'F'))->ancestor()->sibling()->wife(), |
||
| 207 | Relationship::dynamic(static fn (int $n) => $ur($n - 3, 'großonkel', '', 'M'))->ancestor()->brother(), |
||
| 208 | Relationship::dynamic(static fn (int $n) => $ur($n - 3, 'großonkel', '', 'M'))->ancestor()->sibling()->husband(), |
||
| 209 | // descendants |
||
| 210 | Relationship::dynamic(static fn (int $n) => $ur($n - 3, 'großnichte', '', 'F'))->sibling()->descendant()->female(), |
||
| 211 | Relationship::dynamic(static fn (int $n) => $ur($n - 3, 'großnichte', '', 'F'))->married()->spouse()->sibling()->descendant()->female(), |
||
| 212 | Relationship::dynamic(static fn (int $n) => $ur($n - 3, 'großneffe', '', 'M'))->sibling()->descendant()->male(), |
||
| 213 | Relationship::dynamic(static fn (int $n) => $ur($n - 3, 'großneffe', '', 'M'))->married()->spouse()->sibling()->descendant()->male(), |
||
| 214 | Relationship::dynamic(static fn (int $n) => $ur($n - 3, 'enkelin', '', 'F'))->descendant()->female(), |
||
| 215 | Relationship::dynamic(static fn (int $n) => $ur($n - 3, 'enkel', '', 'M'))->descendant()->male(), |
||
| 216 | Relationship::dynamic(static fn (int $n) => $ur($n - 3, 'enkelin/enkel', '', 'U'))->descendant(), |
||
| 217 | ]; |
||
| 220 |
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