@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | { |
47 | 47 | use ModuleChartTrait; |
48 | 48 | |
49 | - protected const ROUTE_URL = '/tree/{tree}/timeline-{scale}'; |
|
49 | + protected const ROUTE_URL = '/tree/{tree}/timeline-{scale}'; |
|
50 | 50 | |
51 | 51 | // Defaults |
52 | 52 | protected const DEFAULT_SCALE = 10; |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | $params = (array) $request->getParsedBody(); |
155 | 155 | |
156 | - $add = $params['add'] ?? ''; |
|
156 | + $add = $params['add'] ?? ''; |
|
157 | 157 | |
158 | 158 | Auth::checkComponentAccess($this, ModuleChartInterface::class, $tree, $user); |
159 | 159 |
@@ -194,7 +194,7 @@ |
||
194 | 194 | // The original filename was generated from the thumbnail filename. |
195 | 195 | // It may not actually exist. |
196 | 196 | try { |
197 | - $file_exists = $data_filesystem->fileExists($original); |
|
197 | + $file_exists = $data_filesystem->fileExists($original); |
|
198 | 198 | } catch (FilesystemException | UnableToRetrieveMetadata $ex) { |
199 | 199 | $file_exists = false; |
200 | 200 | } |
@@ -330,7 +330,7 @@ |
||
330 | 330 | |
331 | 331 | $language = app(ModuleService::class) |
332 | 332 | ->findByInterface(ModuleLanguageInterface::class, true) |
333 | - ->first(fn (ModuleLanguageInterface $language): bool => $language->locale()->languageTag() === I18N::languageTag()); |
|
333 | + ->first(fn(ModuleLanguageInterface $language): bool => $language->locale()->languageTag() === I18N::languageTag()); |
|
334 | 334 | |
335 | 335 | |
336 | 336 |
@@ -76,7 +76,7 @@ |
||
76 | 76 | { |
77 | 77 | $language = app(ModuleService::class) |
78 | 78 | ->findByInterface(ModuleLanguageInterface::class, true) |
79 | - ->first(fn (ModuleLanguageInterface $language): bool => $language->locale()->languageTag() === I18N::languageTag()); |
|
79 | + ->first(fn(ModuleLanguageInterface $language): bool => $language->locale()->languageTag() === I18N::languageTag()); |
|
80 | 80 | |
81 | 81 | $path = $this->getCloseRelationship($individual1, $individual2); |
82 | 82 |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function relationships(): array |
88 | 88 | { |
89 | - $pra = fn (int $n, string $nominative, string $genitive): array => [ |
|
89 | + $pra = fn(int $n, string $nominative, string $genitive): array => [ |
|
90 | 90 | ($n > 3 ? 'pra ×' . $n . ' ' : str_repeat('pra-', $n)) . $nominative, |
91 | 91 | ($n > 3 ? 'pra ×' . $n . ' ' : str_repeat('pra-', $n)) . $genitive, |
92 | 92 | ]; |
93 | 93 | |
94 | - $cousin = fn (int $n, array $cousins, string $nominative, string $genitive): array => $cousins[$n] ?? [ |
|
94 | + $cousin = fn(int $n, array $cousins, string $nominative, string $genitive): array => $cousins[$n] ?? [ |
|
95 | 95 | $nominative . ' z ' . $n . '. kolena', |
96 | 96 | $genitive . '%s z ' . $n . '. kolena', |
97 | 97 | ]; |
@@ -147,9 +147,9 @@ discard block |
||
147 | 147 | Relationship::fixed('prastarý otec', '%s prastarého otca')->parent()->parent()->mother(), |
148 | 148 | Relationship::fixed('prastarý otec', '%s prastarého otca')->parent()->parent()->parent(), |
149 | 149 | // Ancestors |
150 | - Relationship::dynamic(fn (int $n) => $pra($n - 1, 'prastarý otec', '%s prastarého otca'))->ancestor()->male(), |
|
151 | - Relationship::dynamic(fn (int $n) => $pra($n - 1, 'prastará matka', '%s prastarej matky'))->ancestor()->female(), |
|
152 | - Relationship::dynamic(fn (int $n) => $pra($n - 1, 'prastarý rodič', '%s prastarého rodiča'))->ancestor(), |
|
150 | + Relationship::dynamic(fn(int $n) => $pra($n - 1, 'prastarý otec', '%s prastarého otca'))->ancestor()->male(), |
|
151 | + Relationship::dynamic(fn(int $n) => $pra($n - 1, 'prastará matka', '%s prastarej matky'))->ancestor()->female(), |
|
152 | + Relationship::dynamic(fn(int $n) => $pra($n - 1, 'prastarý rodič', '%s prastarého rodiča'))->ancestor(), |
|
153 | 153 | // Grandchildren |
154 | 154 | Relationship::fixed('vnuk', '%s vnuka')->child()->son(), |
155 | 155 | Relationship::fixed('vnučka', '%s vnučky')->child()->daughter(), |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | Relationship::fixed('pravnučka', '%s pravnučky')->child()->child()->daughter(), |
160 | 160 | Relationship::fixed('pravnúča', '%s pravnúčaťa')->child()->child()->child(), |
161 | 161 | // Descendants |
162 | - Relationship::dynamic(fn (int $n) => $pra($n - 1, 'pravnuk', '%s pravnuka'))->ancestor()->male(), |
|
163 | - Relationship::dynamic(fn (int $n) => $pra($n - 1, 'pravnučka', '%s pravnučky'))->ancestor()->female(), |
|
164 | - Relationship::dynamic(fn (int $n) => $pra($n - 1, 'pravnúča', '%s pravnúčaťa'))->ancestor(), |
|
162 | + Relationship::dynamic(fn(int $n) => $pra($n - 1, 'pravnuk', '%s pravnuka'))->ancestor()->male(), |
|
163 | + Relationship::dynamic(fn(int $n) => $pra($n - 1, 'pravnučka', '%s pravnučky'))->ancestor()->female(), |
|
164 | + Relationship::dynamic(fn(int $n) => $pra($n - 1, 'pravnúča', '%s pravnúčaťa'))->ancestor(), |
|
165 | 165 | // Aunts and uncles |
166 | 166 | Relationship::fixed('ujo', '%s uja')->mother()->brother(), |
167 | 167 | Relationship::fixed('ujčiná', '%s ujčinej')->mother()->brother()->wife(), |
@@ -169,20 +169,20 @@ discard block |
||
169 | 169 | Relationship::fixed('strýko', '%s strýka')->parent()->brother(), |
170 | 170 | Relationship::fixed('teta', '%s tety')->parent()->sister(), |
171 | 171 | // Great-aunts and great-uncles |
172 | - Relationship::dynamic(fn (int $n) => $pra($n - 2, 'prastrýko', '%s prastrýka'))->ancestor()->brother(), |
|
173 | - Relationship::dynamic(fn (int $n) => $pra($n - 2, 'prateta', '%s pratety'))->ancestor()->sister(), |
|
172 | + Relationship::dynamic(fn(int $n) => $pra($n - 2, 'prastrýko', '%s prastrýka'))->ancestor()->brother(), |
|
173 | + Relationship::dynamic(fn(int $n) => $pra($n - 2, 'prateta', '%s pratety'))->ancestor()->sister(), |
|
174 | 174 | // Nieces and nephews |
175 | 175 | Relationship::fixed('synovec', '%s synovca')->sibling()->son(), |
176 | 176 | Relationship::fixed('neter', '%s netere')->sibling()->daughter(), |
177 | 177 | // Great-nieces and great-nephews |
178 | 178 | Relationship::fixed('prasynovec', '%s prasynovca')->sibling()->child()->son(), |
179 | 179 | Relationship::fixed('praneter', '%s pranetere')->sibling()->child()->daughter(), |
180 | - Relationship::dynamic(fn (int $n) => $pra($n - 2, 'prasynovec', '%s prasynovca'))->sibling()->descendant()->son(), |
|
181 | - Relationship::dynamic(fn (int $n) => $pra($n - 2, 'praneter', '%s pranetere'))->sibling()->descendant()->daughter(), |
|
180 | + Relationship::dynamic(fn(int $n) => $pra($n - 2, 'prasynovec', '%s prasynovca'))->sibling()->descendant()->son(), |
|
181 | + Relationship::dynamic(fn(int $n) => $pra($n - 2, 'praneter', '%s pranetere'))->sibling()->descendant()->daughter(), |
|
182 | 182 | // Cousins |
183 | - Relationship::dynamic(fn (int $n): array => $cousin($n, static::FEMALE_COUSINS, '', ''))->symmetricCousin()->female(), |
|
184 | - Relationship::dynamic(fn (int $n): array => $cousin($n, static::MALE_COUSINS, '', ''))->symmetricCousin()->male(), |
|
185 | - Relationship::dynamic(fn (int $n): array => $cousin($n, static::MALE_COUSINS, '', ''))->symmetricCousin(), |
|
183 | + Relationship::dynamic(fn(int $n): array => $cousin($n, static::FEMALE_COUSINS, '', ''))->symmetricCousin()->female(), |
|
184 | + Relationship::dynamic(fn(int $n): array => $cousin($n, static::MALE_COUSINS, '', ''))->symmetricCousin()->male(), |
|
185 | + Relationship::dynamic(fn(int $n): array => $cousin($n, static::MALE_COUSINS, '', ''))->symmetricCousin(), |
|
186 | 186 | ]; |
187 | 187 | } |
188 | 188 | } |
@@ -118,15 +118,15 @@ discard block |
||
118 | 118 | public function relationships(): array |
119 | 119 | { |
120 | 120 | // Genitive forms in English are simple/regular, as no relationship name ends in "s". |
121 | - $genitive = fn (string $s): array => [$s, $s . '’s %s']; |
|
121 | + $genitive = fn(string $s): array => [$s, $s . '’s %s']; |
|
122 | 122 | |
123 | - $cousin = fn (int $up, int $down): array => $genitive( |
|
123 | + $cousin = fn(int $up, int $down): array => $genitive( |
|
124 | 124 | (static::COUSIN[min($up, $down)] ?? 'distant cousin') . |
125 | 125 | (static::REMOVED[abs($up - $down)] ?? ' many times removed') . |
126 | 126 | static::DIRECTION[$up <=> $down] |
127 | 127 | ); |
128 | 128 | |
129 | - $great = fn (int $n, string $prefix, string $suffix): array => $genitive( |
|
129 | + $great = fn(int $n, string $prefix, string $suffix): array => $genitive( |
|
130 | 130 | $prefix . ($n > 3 ? 'great ×' . $n . ' ' : str_repeat('great-', $n)) . $suffix |
131 | 131 | ); |
132 | 132 | |
@@ -221,22 +221,22 @@ discard block |
||
221 | 221 | Relationship::fixed('grandson', 'grandson’s %s')->child()->son(), |
222 | 222 | Relationship::fixed('grandchild', 'grandchild’s %s')->child()->child(), |
223 | 223 | // Relationships with dynamically generated names |
224 | - Relationship::dynamic(fn (int $n) => $great($n - 1, '', 'aunt'))->ancestor()->sister(), |
|
225 | - Relationship::dynamic(fn (int $n) => $great($n - 1, '', 'aunt'))->ancestor()->sibling()->wife(), |
|
226 | - Relationship::dynamic(fn (int $n) => $great($n - 1, '', 'uncle'))->ancestor()->brother(), |
|
227 | - Relationship::dynamic(fn (int $n) => $great($n - 1, '', 'uncle'))->ancestor()->sibling()->husband(), |
|
228 | - Relationship::dynamic(fn (int $n) => $great($n - 1, '', 'niece'))->sibling()->descendant()->female(), |
|
229 | - Relationship::dynamic(fn (int $n) => $great($n - 1, '', 'niece'))->married()->spouse()->sibling()->descendant()->female(), |
|
230 | - Relationship::dynamic(fn (int $n) => $great($n - 1, '', 'nephew'))->sibling()->descendant()->male(), |
|
231 | - Relationship::dynamic(fn (int $n) => $great($n - 1, '', 'nephew'))->married()->spouse()->sibling()->descendant()->male(), |
|
232 | - Relationship::dynamic(fn (int $n) => $great($n - 2, 'maternal ', 'grandmother'))->mother()->ancestor()->female(), |
|
233 | - Relationship::dynamic(fn (int $n) => $great($n - 1, 'maternal ', 'grandfather'))->mother()->ancestor()->male(), |
|
234 | - Relationship::dynamic(fn (int $n) => $great($n - 1, 'paternal ', 'grandmother'))->father()->ancestor()->female(), |
|
235 | - Relationship::dynamic(fn (int $n) => $great($n - 1, 'paternal ', 'grandfather'))->father()->ancestor()->male(), |
|
236 | - Relationship::dynamic(fn (int $n) => $great($n - 1, '', 'grandparent'))->ancestor(), |
|
237 | - Relationship::dynamic(fn (int $n) => $great($n - 2, '', 'granddaughter'))->descendant()->female(), |
|
238 | - Relationship::dynamic(fn (int $n) => $great($n - 2, '', 'grandson'))->descendant()->male(), |
|
239 | - Relationship::dynamic(fn (int $n) => $great($n - 2, '', 'grandchild'))->descendant(), |
|
224 | + Relationship::dynamic(fn(int $n) => $great($n - 1, '', 'aunt'))->ancestor()->sister(), |
|
225 | + Relationship::dynamic(fn(int $n) => $great($n - 1, '', 'aunt'))->ancestor()->sibling()->wife(), |
|
226 | + Relationship::dynamic(fn(int $n) => $great($n - 1, '', 'uncle'))->ancestor()->brother(), |
|
227 | + Relationship::dynamic(fn(int $n) => $great($n - 1, '', 'uncle'))->ancestor()->sibling()->husband(), |
|
228 | + Relationship::dynamic(fn(int $n) => $great($n - 1, '', 'niece'))->sibling()->descendant()->female(), |
|
229 | + Relationship::dynamic(fn(int $n) => $great($n - 1, '', 'niece'))->married()->spouse()->sibling()->descendant()->female(), |
|
230 | + Relationship::dynamic(fn(int $n) => $great($n - 1, '', 'nephew'))->sibling()->descendant()->male(), |
|
231 | + Relationship::dynamic(fn(int $n) => $great($n - 1, '', 'nephew'))->married()->spouse()->sibling()->descendant()->male(), |
|
232 | + Relationship::dynamic(fn(int $n) => $great($n - 2, 'maternal ', 'grandmother'))->mother()->ancestor()->female(), |
|
233 | + Relationship::dynamic(fn(int $n) => $great($n - 1, 'maternal ', 'grandfather'))->mother()->ancestor()->male(), |
|
234 | + Relationship::dynamic(fn(int $n) => $great($n - 1, 'paternal ', 'grandmother'))->father()->ancestor()->female(), |
|
235 | + Relationship::dynamic(fn(int $n) => $great($n - 1, 'paternal ', 'grandfather'))->father()->ancestor()->male(), |
|
236 | + Relationship::dynamic(fn(int $n) => $great($n - 1, '', 'grandparent'))->ancestor(), |
|
237 | + Relationship::dynamic(fn(int $n) => $great($n - 2, '', 'granddaughter'))->descendant()->female(), |
|
238 | + Relationship::dynamic(fn(int $n) => $great($n - 2, '', 'grandson'))->descendant()->male(), |
|
239 | + Relationship::dynamic(fn(int $n) => $great($n - 2, '', 'grandchild'))->descendant(), |
|
240 | 240 | Relationship::dynamic($cousin)->ancestor()->sibling()->descendant(), |
241 | 241 | ]; |
242 | 242 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public static function fixed(string $nominative, string $genitive): Relationship |
83 | 83 | { |
84 | - return new self(fn () => [$nominative, $genitive]); |
|
84 | + return new self(fn() => [$nominative, $genitive]); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -126,9 +126,9 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function adopted(): Relationship |
128 | 128 | { |
129 | - $this->matchers[] = fn (array $nodes): bool => count($nodes) > 2 && $nodes[2] |
|
129 | + $this->matchers[] = fn(array $nodes): bool => count($nodes) > 2 && $nodes[2] |
|
130 | 130 | ->facts(['FAMC'], false, Auth::PRIV_HIDE) |
131 | - ->contains(fn (Fact $fact): bool => $fact->value() === '@' . $nodes[1]->xref() . '@' && $fact->attribute('PEDI') === 'adopted'); |
|
131 | + ->contains(fn(Fact $fact): bool => $fact->value() === '@' . $nodes[1]->xref() . '@' && $fact->attribute('PEDI') === 'adopted'); |
|
132 | 132 | |
133 | 133 | return $this; |
134 | 134 | } |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function adoptive(): Relationship |
140 | 140 | { |
141 | - $this->matchers[] = fn (array $nodes): bool => $nodes[0] |
|
141 | + $this->matchers[] = fn(array $nodes): bool => $nodes[0] |
|
142 | 142 | ->facts(['FAMC'], false, Auth::PRIV_HIDE) |
143 | - ->contains(fn (Fact $fact): bool => $fact->value() === '@' . $nodes[1]->xref() . '@' && $fact->attribute('PEDI') === 'adopted'); |
|
143 | + ->contains(fn(Fact $fact): bool => $fact->value() === '@' . $nodes[1]->xref() . '@' && $fact->attribute('PEDI') === 'adopted'); |
|
144 | 144 | |
145 | 145 | return $this; |
146 | 146 | } |
@@ -346,9 +346,9 @@ discard block |
||
346 | 346 | */ |
347 | 347 | public function fostered(): Relationship |
348 | 348 | { |
349 | - $this->matchers[] = fn (array $nodes): bool => count($nodes) > 2 && $nodes[2] |
|
349 | + $this->matchers[] = fn(array $nodes): bool => count($nodes) > 2 && $nodes[2] |
|
350 | 350 | ->facts(['FAMC'], false, Auth::PRIV_HIDE) |
351 | - ->contains(fn (Fact $fact): bool => $fact->value() === '@' . $nodes[1]->xref() . '@' && $fact->attribute('PEDI') === 'foster'); |
|
351 | + ->contains(fn(Fact $fact): bool => $fact->value() === '@' . $nodes[1]->xref() . '@' && $fact->attribute('PEDI') === 'foster'); |
|
352 | 352 | |
353 | 353 | return $this; |
354 | 354 | } |
@@ -358,9 +358,9 @@ discard block |
||
358 | 358 | */ |
359 | 359 | public function fostering(): Relationship |
360 | 360 | { |
361 | - $this->matchers[] = fn (array $nodes): bool => $nodes[0] |
|
361 | + $this->matchers[] = fn(array $nodes): bool => $nodes[0] |
|
362 | 362 | ->facts(['FAMC'], false, Auth::PRIV_HIDE) |
363 | - ->contains(fn (Fact $fact): bool => $fact->value() === '@' . $nodes[1]->xref() . '@' && $fact->attribute('PEDI') === 'foster'); |
|
363 | + ->contains(fn(Fact $fact): bool => $fact->value() === '@' . $nodes[1]->xref() . '@' && $fact->attribute('PEDI') === 'foster'); |
|
364 | 364 | |
365 | 365 | return $this; |
366 | 366 | } |
@@ -403,8 +403,8 @@ discard block |
||
403 | 403 | public function older(): Relationship |
404 | 404 | { |
405 | 405 | $this->matchers[] = static function (array $nodes): bool { |
406 | - $date1 = $nodes[0]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn (Fact $fact): Date => $fact->date())->first() ?? new Date(''); |
|
407 | - $date2 = $nodes[2]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn (Fact $fact): Date => $fact->date())->first() ?? new Date(''); |
|
406 | + $date1 = $nodes[0]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn(Fact $fact): Date => $fact->date())->first() ?? new Date(''); |
|
407 | + $date2 = $nodes[2]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn(Fact $fact): Date => $fact->date())->first() ?? new Date(''); |
|
408 | 408 | |
409 | 409 | return Date::compare($date1, $date2) > 0; |
410 | 410 | }; |
@@ -503,8 +503,8 @@ discard block |
||
503 | 503 | public function twin(): Relationship |
504 | 504 | { |
505 | 505 | $this->matchers[] = static function (array $nodes): bool { |
506 | - $date1 = $nodes[0]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn (Fact $fact): Date => $fact->date())->first() ?? new Date(''); |
|
507 | - $date2 = $nodes[2]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn (Fact $fact): Date => $fact->date())->first() ?? new Date(''); |
|
506 | + $date1 = $nodes[0]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn(Fact $fact): Date => $fact->date())->first() ?? new Date(''); |
|
507 | + $date2 = $nodes[2]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn(Fact $fact): Date => $fact->date())->first() ?? new Date(''); |
|
508 | 508 | |
509 | 509 | return |
510 | 510 | $date1->isOK() && |
@@ -531,8 +531,8 @@ discard block |
||
531 | 531 | public function younger(): Relationship |
532 | 532 | { |
533 | 533 | $this->matchers[] = static function (array $nodes): bool { |
534 | - $date1 = $nodes[0]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn (Fact $fact): Date => $fact->date())->first() ?? new Date(''); |
|
535 | - $date2 = $nodes[2]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn (Fact $fact): Date => $fact->date())->first() ?? new Date(''); |
|
534 | + $date1 = $nodes[0]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn(Fact $fact): Date => $fact->date())->first() ?? new Date(''); |
|
535 | + $date2 = $nodes[2]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn(Fact $fact): Date => $fact->date())->first() ?? new Date(''); |
|
536 | 536 | |
537 | 537 | return Date::compare($date1, $date2) < 0; |
538 | 538 | }; |
@@ -326,7 +326,7 @@ |
||
326 | 326 | |
327 | 327 | self::$language = $module_service |
328 | 328 | ->findByInterface(ModuleLanguageInterface::class) |
329 | - ->first(fn (ModuleLanguageInterface $module): bool => $module->locale()->languageTag() === $code); |
|
329 | + ->first(fn(ModuleLanguageInterface $module): bool => $module->locale()->languageTag() === $code); |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | // Create a translator |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | 1 => [ |
35 | 35 | 'F' => ['cousine germaine', '$s de la cousine germaine'], |
36 | 36 | 'M' => ['cousin germain', '$s du cousin germain'], |
37 | - 'U' => ['cousin germain', '%s du cousin germain' ] |
|
37 | + 'U' => ['cousin germain', '%s du cousin germain'] |
|
38 | 38 | ], |
39 | 39 | 2 => [ |
40 | 40 | 'F' => ['cousine issue de germain', '$s de la cousine issue de germain'], |
41 | 41 | 'M' => ['cousin issu de germain', '$s du cousin issu de germain'], |
42 | - 'U' => ['cousin issu de germain', '%s du cousin issu de germain' ] |
|
42 | + 'U' => ['cousin issu de germain', '%s du cousin issu de germain'] |
|
43 | 43 | ] |
44 | 44 | ]; |
45 | 45 | |
@@ -110,26 +110,26 @@ discard block |
||
110 | 110 | public function relationships(): array |
111 | 111 | { |
112 | 112 | // Construct the genitive form in French |
113 | - $genitive = fn (string $s, string $genitive_link): array => [$s, '%s ' . $genitive_link . $s]; |
|
113 | + $genitive = fn(string $s, string $genitive_link): array => [$s, '%s ' . $genitive_link . $s]; |
|
114 | 114 | |
115 | 115 | // Functions to coumpound the name that can be indefinitely repeated |
116 | - $degree = fn (int $n, string $suffix, string $genitive_link): array => |
|
116 | + $degree = fn(int $n, string $suffix, string $genitive_link): array => |
|
117 | 117 | $genitive("$suffix au {$n}<sup>e</sup> degré", $genitive_link); |
118 | 118 | |
119 | - $great = fn (int $n, string $suffix, string $genitive_link): array => |
|
119 | + $great = fn(int $n, string $suffix, string $genitive_link): array => |
|
120 | 120 | $n <= 1 ? $genitive('arrière-' . $suffix, 'de l’') : $degree($n + 1, $suffix, $genitive_link); |
121 | 121 | |
122 | - $firstCompound = fn (int $n, string $suffix, string $genitive_link): array => |
|
122 | + $firstCompound = fn(int $n, string $suffix, string $genitive_link): array => |
|
123 | 123 | $n <= 1 ? $genitive($suffix, $genitive_link) : $great($n - 1, $suffix, $genitive_link); |
124 | 124 | |
125 | 125 | $compound = |
126 | - fn (int $n, string $first_level, string $suffix, string $genitive_none, string $genitive_first): array => |
|
126 | + fn(int $n, string $first_level, string $suffix, string $genitive_none, string $genitive_first): array => |
|
127 | 127 | $n <= 1 ? $genitive($suffix, $genitive_none) : $firstCompound($n - 1, $first_level . $suffix, $genitive_first); |
128 | 128 | |
129 | 129 | // Functions to translate cousins' degree of relationship |
130 | - $symmetricCousin = fn (int $n, string $sex): array => self::SYMMETRIC_COUSINS[$n][$sex] ?? $genitive( |
|
130 | + $symmetricCousin = fn(int $n, string $sex): array => self::SYMMETRIC_COUSINS[$n][$sex] ?? $genitive( |
|
131 | 131 | $sex === 'F' ? 'cousine au ' . $n . '<sup>e</sup> degré' : 'cousin au ' . $n . '<sup>e</sup> degré', |
132 | - $sex === 'F' ? 'de la ' : 'du ' |
|
132 | + $sex === 'F' ? 'de la ' : 'du ' |
|
133 | 133 | ); |
134 | 134 | |
135 | 135 | $cousin = |
@@ -144,9 +144,8 @@ discard block |
||
144 | 144 | } |
145 | 145 | return $genitive( |
146 | 146 | $sex === 'F' ? |
147 | - 'cousine du ' . $down . '<sup>e</sup> au ' . $up . '<sup>e</sup> degré' : |
|
148 | - 'cousin du ' . $down . '<sup>e</sup> au ' . $up . '<sup>e</sup> degré', |
|
149 | - $sex === 'F' ? 'de la ' : 'du ' |
|
147 | + 'cousine du ' . $down . '<sup>e</sup> au ' . $up . '<sup>e</sup> degré' : 'cousin du ' . $down . '<sup>e</sup> au ' . $up . '<sup>e</sup> degré', |
|
148 | + $sex === 'F' ? 'de la ' : 'du ' |
|
150 | 149 | ); |
151 | 150 | }; |
152 | 151 | |
@@ -264,31 +263,31 @@ discard block |
||
264 | 263 | Relationship::fixed('trisaïeul paternel', '% du trisaïeul paternel')->father()->parent()->parent()->father(), |
265 | 264 | Relationship::fixed('trisaïeule', '% de la trisaïeule')->parent()->parent()->parent()->mother(), |
266 | 265 | Relationship::fixed('trisaïeul', '% du trisaïeul')->parent()->parent()->parent()->father(), |
267 | - Relationship::dynamic(fn (int $n) => $firstCompound($n, 'grand-mère maternelle', 'de la '))->mother()->ancestor()->female(), |
|
268 | - Relationship::dynamic(fn (int $n) => $firstCompound($n, 'grand-père maternel', 'du '))->mother()->ancestor()->male(), |
|
269 | - Relationship::dynamic(fn (int $n) => $firstCompound($n, 'grand-parent maternel', 'du '))->mother()->ancestor(), |
|
270 | - Relationship::dynamic(fn (int $n) => $firstCompound($n, 'grand-mère paternelle', 'de la '))->father()->ancestor()->female(), |
|
271 | - Relationship::dynamic(fn (int $n) => $firstCompound($n, 'grand-père paternel', 'du '))->father()->ancestor()->male(), |
|
272 | - Relationship::dynamic(fn (int $n) => $firstCompound($n, 'grand-parent paternel', 'du '))->father()->ancestor(), |
|
273 | - Relationship::dynamic(fn (int $n) => $firstCompound($n, 'grand-mère', 'de la '))->parent()->ancestor()->female(), |
|
274 | - Relationship::dynamic(fn (int $n) => $firstCompound($n, 'grand-père', 'du '))->parent()->ancestor()->male(), |
|
275 | - Relationship::dynamic(fn (int $n) => $firstCompound($n, 'grand-parent', 'du '))->parent()->ancestor(), |
|
266 | + Relationship::dynamic(fn(int $n) => $firstCompound($n, 'grand-mère maternelle', 'de la '))->mother()->ancestor()->female(), |
|
267 | + Relationship::dynamic(fn(int $n) => $firstCompound($n, 'grand-père maternel', 'du '))->mother()->ancestor()->male(), |
|
268 | + Relationship::dynamic(fn(int $n) => $firstCompound($n, 'grand-parent maternel', 'du '))->mother()->ancestor(), |
|
269 | + Relationship::dynamic(fn(int $n) => $firstCompound($n, 'grand-mère paternelle', 'de la '))->father()->ancestor()->female(), |
|
270 | + Relationship::dynamic(fn(int $n) => $firstCompound($n, 'grand-père paternel', 'du '))->father()->ancestor()->male(), |
|
271 | + Relationship::dynamic(fn(int $n) => $firstCompound($n, 'grand-parent paternel', 'du '))->father()->ancestor(), |
|
272 | + Relationship::dynamic(fn(int $n) => $firstCompound($n, 'grand-mère', 'de la '))->parent()->ancestor()->female(), |
|
273 | + Relationship::dynamic(fn(int $n) => $firstCompound($n, 'grand-père', 'du '))->parent()->ancestor()->male(), |
|
274 | + Relationship::dynamic(fn(int $n) => $firstCompound($n, 'grand-parent', 'du '))->parent()->ancestor(), |
|
276 | 275 | // Grandchildren and below |
277 | - Relationship::dynamic(fn (int $n) => $firstCompound($n, 'petite-fille', 'de la '))->child()->descendant()->female(), |
|
278 | - Relationship::dynamic(fn (int $n) => $firstCompound($n, 'petit-fils', 'du '))->child()->descendant()->male(), |
|
279 | - Relationship::dynamic(fn (int $n) => $firstCompound($n, 'petit-enfant', 'du '))->child()->descendant(), |
|
276 | + Relationship::dynamic(fn(int $n) => $firstCompound($n, 'petite-fille', 'de la '))->child()->descendant()->female(), |
|
277 | + Relationship::dynamic(fn(int $n) => $firstCompound($n, 'petit-fils', 'du '))->child()->descendant()->male(), |
|
278 | + Relationship::dynamic(fn(int $n) => $firstCompound($n, 'petit-enfant', 'du '))->child()->descendant(), |
|
280 | 279 | // Collateral relatives |
281 | - Relationship::dynamic(fn (int $n) => $compound($n, 'grand-', 'tante', 'de la ', 'de la '))->ancestor()->sister(), |
|
282 | - Relationship::dynamic(fn (int $n) => $compound($n, 'grand-', 'tante par alliance', 'de la ', 'de la '))->ancestor()->sibling()->wife(), |
|
283 | - Relationship::dynamic(fn (int $n) => $compound($n, 'grand-', 'oncle', 'de l’', 'du '))->ancestor()->brother(), |
|
284 | - Relationship::dynamic(fn (int $n) => $compound($n, 'grand-', 'oncle par alliance', 'de l’', 'du '))->ancestor()->sibling()->husband(), |
|
285 | - Relationship::dynamic(fn (int $n) => $compound($n, 'petite-', 'nièce', 'de la ', 'de la '))->sibling()->descendant()->female(), |
|
286 | - Relationship::dynamic(fn (int $n) => $compound($n, 'petite-', 'nièce par alliance', 'de la ', 'de la '))->married()->spouse()->sibling()->descendant()->female(), |
|
287 | - Relationship::dynamic(fn (int $n) => $compound($n, 'petit-', 'neveu', 'du ', 'du '))->sibling()->descendant()->male(), |
|
288 | - Relationship::dynamic(fn (int $n) => $compound($n, 'petit-', 'neveu par alliance', 'du ', 'du '))->married()->spouse()->sibling()->descendant()->male(), |
|
280 | + Relationship::dynamic(fn(int $n) => $compound($n, 'grand-', 'tante', 'de la ', 'de la '))->ancestor()->sister(), |
|
281 | + Relationship::dynamic(fn(int $n) => $compound($n, 'grand-', 'tante par alliance', 'de la ', 'de la '))->ancestor()->sibling()->wife(), |
|
282 | + Relationship::dynamic(fn(int $n) => $compound($n, 'grand-', 'oncle', 'de l’', 'du '))->ancestor()->brother(), |
|
283 | + Relationship::dynamic(fn(int $n) => $compound($n, 'grand-', 'oncle par alliance', 'de l’', 'du '))->ancestor()->sibling()->husband(), |
|
284 | + Relationship::dynamic(fn(int $n) => $compound($n, 'petite-', 'nièce', 'de la ', 'de la '))->sibling()->descendant()->female(), |
|
285 | + Relationship::dynamic(fn(int $n) => $compound($n, 'petite-', 'nièce par alliance', 'de la ', 'de la '))->married()->spouse()->sibling()->descendant()->female(), |
|
286 | + Relationship::dynamic(fn(int $n) => $compound($n, 'petit-', 'neveu', 'du ', 'du '))->sibling()->descendant()->male(), |
|
287 | + Relationship::dynamic(fn(int $n) => $compound($n, 'petit-', 'neveu par alliance', 'du ', 'du '))->married()->spouse()->sibling()->descendant()->male(), |
|
289 | 288 | // Cousins (based on canon law) |
290 | - Relationship::dynamic(fn (int $up, int $down) => $cousin($up, $down, 'F'))->cousin()->female(), |
|
291 | - Relationship::dynamic(fn (int $up, int $down) => $cousin($up, $down, 'M'))->cousin()->male(), |
|
289 | + Relationship::dynamic(fn(int $up, int $down) => $cousin($up, $down, 'F'))->cousin()->female(), |
|
290 | + Relationship::dynamic(fn(int $up, int $down) => $cousin($up, $down, 'M'))->cousin()->male(), |
|
292 | 291 | |
293 | 292 | ]; |
294 | 293 | } |