@@ -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 | /** |
@@ -162,10 +162,10 @@ discard block |
||
162 | 162 | */ |
163 | 163 | protected function linkedByType(string $pedigree_type, bool $is_default = false): Relationship |
164 | 164 | { |
165 | - $this->matchers[] = fn (array $nodes): bool => count($nodes) > 2 && $nodes[2] |
|
165 | + $this->matchers[] = fn(array $nodes): bool => count($nodes) > 2 && $nodes[2] |
|
166 | 166 | ->facts(['FAMC'], false, Auth::PRIV_HIDE) |
167 | - ->map(fn (Fact $fact): array => [$fact->value(), $fact->attribute('PEDI')]) |
|
168 | - ->contains(fn (array $fact): bool => $fact[0] === '@' . $nodes[1]->xref() . '@' |
|
167 | + ->map(fn(Fact $fact): array => [$fact->value(), $fact->attribute('PEDI')]) |
|
168 | + ->contains(fn(array $fact): bool => $fact[0] === '@' . $nodes[1]->xref() . '@' |
|
169 | 169 | && ($fact[1] === $pedigree_type || ($fact[1] === '' && $is_default))); |
170 | 170 | |
171 | 171 | return $this; |
@@ -179,10 +179,10 @@ discard block |
||
179 | 179 | */ |
180 | 180 | protected function linkingByType(string $pedigree_type, bool $is_default = false): Relationship |
181 | 181 | { |
182 | - $this->matchers[] = fn (array $nodes): bool => count($nodes) > 1 && $nodes[0] |
|
182 | + $this->matchers[] = fn(array $nodes): bool => count($nodes) > 1 && $nodes[0] |
|
183 | 183 | ->facts(['FAMC'], false, Auth::PRIV_HIDE) |
184 | - ->map(fn (Fact $fact): array => [$fact->value(), $fact->attribute('PEDI')]) |
|
185 | - ->contains(fn (array $fact): bool => $fact[0] === '@' . $nodes[1]->xref() . '@' |
|
184 | + ->map(fn(Fact $fact): array => [$fact->value(), $fact->attribute('PEDI')]) |
|
185 | + ->contains(fn(array $fact): bool => $fact[0] === '@' . $nodes[1]->xref() . '@' |
|
186 | 186 | && ($fact[1] === $pedigree_type || ($fact[1] === '' && $is_default))); |
187 | 187 | |
188 | 188 | return $this; |
@@ -438,8 +438,8 @@ discard block |
||
438 | 438 | public function older(): Relationship |
439 | 439 | { |
440 | 440 | $this->matchers[] = static function (array $nodes): bool { |
441 | - $date1 = $nodes[0]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn (Fact $fact): Date => $fact->date())->first() ?? new Date(''); |
|
442 | - $date2 = $nodes[2]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn (Fact $fact): Date => $fact->date())->first() ?? new Date(''); |
|
441 | + $date1 = $nodes[0]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn(Fact $fact): Date => $fact->date())->first() ?? new Date(''); |
|
442 | + $date2 = $nodes[2]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn(Fact $fact): Date => $fact->date())->first() ?? new Date(''); |
|
443 | 443 | |
444 | 444 | return Date::compare($date1, $date2) > 0; |
445 | 445 | }; |
@@ -538,8 +538,8 @@ discard block |
||
538 | 538 | public function twin(): Relationship |
539 | 539 | { |
540 | 540 | $this->matchers[] = static function (array $nodes): bool { |
541 | - $date1 = $nodes[0]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn (Fact $fact): Date => $fact->date())->first() ?? new Date(''); |
|
542 | - $date2 = $nodes[2]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn (Fact $fact): Date => $fact->date())->first() ?? new Date(''); |
|
541 | + $date1 = $nodes[0]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn(Fact $fact): Date => $fact->date())->first() ?? new Date(''); |
|
542 | + $date2 = $nodes[2]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn(Fact $fact): Date => $fact->date())->first() ?? new Date(''); |
|
543 | 543 | |
544 | 544 | return |
545 | 545 | $date1->isOK() && |
@@ -582,8 +582,8 @@ discard block |
||
582 | 582 | public function younger(): Relationship |
583 | 583 | { |
584 | 584 | $this->matchers[] = static function (array $nodes): bool { |
585 | - $date1 = $nodes[0]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn (Fact $fact): Date => $fact->date())->first() ?? new Date(''); |
|
586 | - $date2 = $nodes[2]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn (Fact $fact): Date => $fact->date())->first() ?? new Date(''); |
|
585 | + $date1 = $nodes[0]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn(Fact $fact): Date => $fact->date())->first() ?? new Date(''); |
|
586 | + $date2 = $nodes[2]->facts(['BIRT'], false, Auth::PRIV_HIDE)->map(fn(Fact $fact): Date => $fact->date())->first() ?? new Date(''); |
|
587 | 587 | |
588 | 588 | return Date::compare($date1, $date2) < 0; |
589 | 589 | }; |
@@ -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 | } |