@@ -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[] = static fn (array $nodes): bool => count($nodes) > 2 && $nodes[2] |
|
| 129 | + $this->matchers[] = static 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[] = static fn (array $nodes): bool => $nodes[0] |
|
| 141 | + $this->matchers[] = static 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[] = static fn (array $nodes): bool => count($nodes) > 2 && $nodes[2] |
|
| 349 | + $this->matchers[] = static 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[] = static fn (array $nodes): bool => $nodes[0] |
|
| 361 | + $this->matchers[] = static 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 | }; |
@@ -80,7 +80,7 @@ |
||
| 80 | 80 | // Default names facts. |
| 81 | 81 | $surname_tradition = SurnameTradition::create($tree->getPreference('SURNAME_TRADITION')); |
| 82 | 82 | $names = $surname_tradition->newParentNames($individual, $sex); |
| 83 | - $name_facts = array_map(static fn (string $gedcom): Fact => new Fact($gedcom, $dummy, ''), $names); |
|
| 83 | + $name_facts = array_map(static fn(string $gedcom): Fact => new Fact($gedcom, $dummy, ''), $names); |
|
| 84 | 84 | |
| 85 | 85 | $facts = [ |
| 86 | 86 | 'i' => [ |
@@ -86,7 +86,7 @@ |
||
| 86 | 86 | // Default names facts. |
| 87 | 87 | $surname_tradition = SurnameTradition::create($tree->getPreference('SURNAME_TRADITION')); |
| 88 | 88 | $names = $surname_tradition->newSpouseNames($individual, $sex); |
| 89 | - $name_facts = array_map(static fn (string $gedcom): Fact => new Fact($gedcom, $dummyi, ''), $names); |
|
| 89 | + $name_facts = array_map(static fn(string $gedcom): Fact => new Fact($gedcom, $dummyi, ''), $names); |
|
| 90 | 90 | |
| 91 | 91 | $facts = [ |
| 92 | 92 | 'i' => [ |
@@ -94,7 +94,7 @@ |
||
| 94 | 94 | |
| 95 | 95 | case 'name': |
| 96 | 96 | $name_tags = Registry::elementFactory()->make('INDI:NAME')->subtags(); |
| 97 | - $name_tags = array_map(static fn (string $tag): string => '2 ' . $tag, $name_tags); |
|
| 97 | + $name_tags = array_map(static fn(string $tag): string => '2 ' . $tag, $name_tags); |
|
| 98 | 98 | $name_tags[] = '1 NAME'; |
| 99 | 99 | |
| 100 | 100 | $records = $this->search_service->searchIndividuals([$tree], [$search]); |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | $spouse = $family->spouses()->first(); |
| 85 | 85 | assert($spouse instanceof Individual); |
| 86 | 86 | $names = $surname_tradition->newSpouseNames($spouse, $sex); |
| 87 | - $name_facts = array_map(static fn (string $gedcom): Fact => new Fact($gedcom, $dummyi, ''), $names); |
|
| 87 | + $name_facts = array_map(static fn(string $gedcom): Fact => new Fact($gedcom, $dummyi, ''), $names); |
|
| 88 | 88 | |
| 89 | 89 | $facts = [ |
| 90 | 90 | 'i' => [ |
@@ -91,7 +91,7 @@ |
||
| 91 | 91 | break; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - $name_facts = array_map(static fn (string $gedcom): Fact => new Fact($gedcom, $dummy, ''), $names); |
|
| 94 | + $name_facts = array_map(static fn(string $gedcom): Fact => new Fact($gedcom, $dummy, ''), $names); |
|
| 95 | 95 | |
| 96 | 96 | $facts = [ |
| 97 | 97 | 'i' => [ |
@@ -80,7 +80,7 @@ |
||
| 80 | 80 | // Default names facts. |
| 81 | 81 | $surname_tradition = SurnameTradition::create($tree->getPreference('SURNAME_TRADITION')); |
| 82 | 82 | $names = $surname_tradition->newChildNames($family->husband(), $family->wife(), $sex); |
| 83 | - $name_facts = array_map(static fn (string $gedcom): Fact => new Fact($gedcom, $dummy, ''), $names); |
|
| 83 | + $name_facts = array_map(static fn(string $gedcom): Fact => new Fact($gedcom, $dummy, ''), $names); |
|
| 84 | 84 | |
| 85 | 85 | $facts = [ |
| 86 | 86 | 'i' => [ |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | ->groupBy(['surname']) |
| 114 | 114 | ->select([new Expression('n_surname /*! COLLATE utf8_bin */ AS surname'), new Expression('count(*) AS total')]) |
| 115 | 115 | ->pluck('total', 'surname') |
| 116 | - ->map(static fn (string $n): int => (int) $n) |
|
| 116 | + ->map(static fn(string $n): int => (int) $n) |
|
| 117 | 117 | ->all(); |
| 118 | 118 | |
| 119 | 119 | $all_surnames[$top_surname] = $variants; |
@@ -135,11 +135,11 @@ discard block |
||
| 135 | 135 | $content = FunctionsPrintLists::surnameTagCloud($all_surnames, $module, true, $tree); |
| 136 | 136 | break; |
| 137 | 137 | case 'list': |
| 138 | - uasort($all_surnames, static fn (array $a, array $b): int => array_sum($b) <=> array_sum($a)); |
|
| 138 | + uasort($all_surnames, static fn(array $a, array $b): int => array_sum($b) <=> array_sum($a)); |
|
| 139 | 139 | $content = FunctionsPrintLists::surnameList($all_surnames, 1, true, $module, $tree); |
| 140 | 140 | break; |
| 141 | 141 | case 'array': |
| 142 | - uasort($all_surnames, static fn (array $a, array $b): int => array_sum($b) <=> array_sum($a)); |
|
| 142 | + uasort($all_surnames, static fn(array $a, array $b): int => array_sum($b) <=> array_sum($a)); |
|
| 143 | 143 | $content = FunctionsPrintLists::surnameList($all_surnames, 2, true, $module, $tree); |
| 144 | 144 | break; |
| 145 | 145 | case 'table': |
@@ -86,12 +86,12 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function relationships(): array |
| 88 | 88 | { |
| 89 | - $pra = static fn (int $n, string $nominative, string $genitive): array => [ |
|
| 89 | + $pra = static 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 = static fn (int $n, array $cousins, string $nominative, string $genitive): array => $cousins[$n] ?? [ |
|
| 94 | + $cousin = static 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 | } |