@@ -75,13 +75,13 @@ |
||
75 | 75 | $canonical = $this->canonical($value); |
76 | 76 | |
77 | 77 | return preg_replace_callback_array([ |
78 | - '/CHILD/' => fn () => I18N::translate('Child'), |
|
79 | - '/INFANT/' => fn () => I18N::translate('Infant'), |
|
80 | - '/STILLBORN/' => fn () => I18N::translate('Stillborn'), |
|
81 | - '/\b(\d+)y\b/' => fn (array $match) => I18N::plural('%s year', '%s years', (int) ($match[1]), I18N::number((float) $match[1])), |
|
82 | - '/\b(\d+)m\b/' => fn (array $match) => I18N::plural('%s month', '%s months', (int) ($match[1]), I18N::number((float) $match[1])), |
|
83 | - '/\b(\d+)w\b/' => fn (array $match) => I18N::plural('%s week', '%s weeks', (int) ($match[1]), I18N::number((float) $match[1])), |
|
84 | - '/\b(\d+)d\b/' => fn (array $match) => I18N::plural('%s day', '%s days', (int) ($match[1]), I18N::number((float) $match[1])), |
|
78 | + '/CHILD/' => fn() => I18N::translate('Child'), |
|
79 | + '/INFANT/' => fn() => I18N::translate('Infant'), |
|
80 | + '/STILLBORN/' => fn() => I18N::translate('Stillborn'), |
|
81 | + '/\b(\d+)y\b/' => fn(array $match) => I18N::plural('%s year', '%s years', (int) ($match[1]), I18N::number((float) $match[1])), |
|
82 | + '/\b(\d+)m\b/' => fn(array $match) => I18N::plural('%s month', '%s months', (int) ($match[1]), I18N::number((float) $match[1])), |
|
83 | + '/\b(\d+)w\b/' => fn(array $match) => I18N::plural('%s week', '%s weeks', (int) ($match[1]), I18N::number((float) $match[1])), |
|
84 | + '/\b(\d+)d\b/' => fn(array $match) => I18N::plural('%s day', '%s days', (int) ($match[1]), I18N::number((float) $match[1])), |
|
85 | 85 | ], e($canonical)); |
86 | 86 | } |
87 | 87 | } |
@@ -120,17 +120,17 @@ |
||
120 | 120 | // Which facts and events are handled by other modules? |
121 | 121 | $sidebar_facts = $this->module_service |
122 | 122 | ->findByComponent(ModuleSidebarInterface::class, $individual->tree(), Auth::user()) |
123 | - ->map(fn (ModuleSidebarInterface $sidebar): Collection => $sidebar->supportedFacts()); |
|
123 | + ->map(fn(ModuleSidebarInterface $sidebar): Collection => $sidebar->supportedFacts()); |
|
124 | 124 | |
125 | 125 | $tab_facts = $this->module_service |
126 | 126 | ->findByComponent(ModuleTabInterface::class, $individual->tree(), Auth::user()) |
127 | - ->map(fn (ModuleTabInterface $tab): Collection => $tab->supportedFacts()); |
|
127 | + ->map(fn(ModuleTabInterface $tab): Collection => $tab->supportedFacts()); |
|
128 | 128 | |
129 | 129 | $exclude_facts = $sidebar_facts->merge($tab_facts)->flatten(); |
130 | 130 | |
131 | 131 | // The individual’s own facts |
132 | 132 | $individual_facts = $individual->facts() |
133 | - ->filter(fn (Fact $fact): bool => !$exclude_facts->contains($fact->tag())); |
|
133 | + ->filter(fn(Fact $fact): bool => !$exclude_facts->contains($fact->tag())); |
|
134 | 134 | |
135 | 135 | $relative_facts = new Collection(); |
136 | 136 |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | $access_level = $access_level ?? Auth::accessLevel($this->tree); |
785 | 785 | |
786 | 786 | // Convert BIRT into INDI:BIRT, etc. |
787 | - $filter = array_map(fn (string $tag): string => $this->tag() . ':' . $tag, $filter); |
|
787 | + $filter = array_map(fn(string $tag): string => $this->tag() . ':' . $tag, $filter); |
|
788 | 788 | |
789 | 789 | $facts = new Collection(); |
790 | 790 | if ($this->canShow($access_level)) { |
@@ -804,7 +804,7 @@ discard block |
||
804 | 804 | |
805 | 805 | default: |
806 | 806 | $subtags = Registry::elementFactory()->make($this->tag())->subtags(); |
807 | - $subtags = array_map(fn (string $tag): string => $this->tag() . ':' . $tag, array_keys($subtags)); |
|
807 | + $subtags = array_map(fn(string $tag): string => $this->tag() . ':' . $tag, array_keys($subtags)); |
|
808 | 808 | $subtags = array_combine(range(1, count($subtags)), $subtags); |
809 | 809 | |
810 | 810 | $facts = $facts |
@@ -432,10 +432,10 @@ discard block |
||
432 | 432 | for ($j = 0; $j < $ct; $j++) { |
433 | 433 | if (!str_contains($match[$j][1], '@')) { |
434 | 434 | $source = e($match[$j][1] . preg_replace('/\n\d CONT ?/', "\n", $match[$j][2])); |
435 | - $data .= '<div class="fact_SOUR"><span class="label">' . I18N::translate('Source') . ':</span> <span class="field" dir="auto">'; |
|
435 | + $data .= '<div class="fact_SOUR"><span class="label">' . I18N::translate('Source') . ':</span> <span class="field" dir="auto">'; |
|
436 | 436 | |
437 | 437 | if ($tree->getPreference('FORMAT_TEXT') === 'markdown') { |
438 | - $data .= '<div class="markdown" dir="auto">' ; |
|
438 | + $data .= '<div class="markdown" dir="auto">'; |
|
439 | 439 | $data .= Registry::markdownFactory()->markdown($tree)->convertToHtml($source); |
440 | 440 | $data .= '</div>'; |
441 | 441 | } else { |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | $data .= '</div>'; |
445 | 445 | } |
446 | 446 | |
447 | - $data .= '</span></div>'; |
|
447 | + $data .= '</span></div>'; |
|
448 | 448 | } |
449 | 449 | } |
450 | 450 | // Find source for each fact |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | } |
463 | 463 | $srec = substr($factrec, $spos1, $spos2 - $spos1); |
464 | 464 | $lt = preg_match_all("/$nlevel \w+/", $srec, $matches); |
465 | - $data .= '<div class="fact_SOUR">'; |
|
465 | + $data .= '<div class="fact_SOUR">'; |
|
466 | 466 | $id = 'collapse-' . Uuid::uuid4()->toString(); |
467 | 467 | $expanded = (bool) $tree->getPreference('EXPAND_SOURCES'); |
468 | 468 | if ($lt > 0) { |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | } |
853 | 853 | |
854 | 854 | if ($tree->getPreference('FORMAT_TEXT') === 'markdown') { |
855 | - $formatted_text = '<div class="markdown" dir="auto">' ; |
|
855 | + $formatted_text = '<div class="markdown" dir="auto">'; |
|
856 | 856 | $formatted_text .= Registry::markdownFactory()->markdown($tree)->convertToHtml($text); |
857 | 857 | $formatted_text .= '</div>'; |
858 | 858 | } else { |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | $query->where('individuals.i_gedcom', 'LIKE', $like); |
741 | 741 | break; |
742 | 742 | } |
743 | - } elseif (str_starts_with($field_name, 'INDI:') && str_ends_with($field_name, ':DATE')) { |
|
743 | + } elseif (str_starts_with($field_name, 'INDI:') && str_ends_with($field_name, ':DATE')) { |
|
744 | 744 | $date = new Date($field_value); |
745 | 745 | if ($date->isOK()) { |
746 | 746 | $delta = 365 * ($modifiers[$field_name] ?? 0); |
@@ -750,7 +750,7 @@ discard block |
||
750 | 750 | ->where('date_' . $parts[1] . '.d_julianday2', '<=', $date->maximumJulianDay() + $delta); |
751 | 751 | } |
752 | 752 | unset($fields[$field_name]); |
753 | - } elseif (str_starts_with($field_name, 'FAM:') && str_ends_with($field_name, ':DATE')) { |
|
753 | + } elseif (str_starts_with($field_name, 'FAM:') && str_ends_with($field_name, ':DATE')) { |
|
754 | 754 | $date = new Date($field_value); |
755 | 755 | if ($date->isOK()) { |
756 | 756 | $delta = 365 * $modifiers[$field_name]; |
@@ -760,10 +760,10 @@ discard block |
||
760 | 760 | ->where('date_' . $parts[1] . '.d_julianday2', '<=', $date->maximumJulianDay() + $delta); |
761 | 761 | } |
762 | 762 | unset($fields[$field_name]); |
763 | - } elseif (str_starts_with($field_name, 'INDI:') && str_ends_with($field_name, ':PLAC')) { |
|
763 | + } elseif (str_starts_with($field_name, 'INDI:') && str_ends_with($field_name, ':PLAC')) { |
|
764 | 764 | // SQL can only link a place to a person/family, not to an event. |
765 | 765 | $query->where('individual_places.p_place', 'LIKE', '%' . $field_value . '%'); |
766 | - } elseif (str_starts_with($field_name, 'FAM:') && str_ends_with($field_name, ':PLAC')) { |
|
766 | + } elseif (str_starts_with($field_name, 'FAM:') && str_ends_with($field_name, ':PLAC')) { |
|
767 | 767 | // SQL can only link a place to a person/family, not to an event. |
768 | 768 | $query->where('family_places.p_place', 'LIKE', '%' . $field_value . '%'); |
769 | 769 | } elseif (str_starts_with($field_name, 'MOTHER:NAME:') || str_starts_with($field_name, 'FATHER:NAME:')) { |
@@ -871,7 +871,7 @@ discard block |
||
871 | 871 | |
872 | 872 | $regex = '/' . preg_quote($field_value, '/') . '/i'; |
873 | 873 | |
874 | - if (str_starts_with($field_name, 'INDI:') && str_ends_with($field_name, ':PLAC')) { |
|
874 | + if (str_starts_with($field_name, 'INDI:') && str_ends_with($field_name, ':PLAC')) { |
|
875 | 875 | foreach ($individual->facts([$parts[1]]) as $fact) { |
876 | 876 | if (preg_match($regex, $fact->place()->gedcomName())) { |
877 | 877 | continue 2; |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | return false; |
881 | 881 | } |
882 | 882 | |
883 | - if (str_starts_with($field_name, 'FAM:') && str_ends_with($field_name, ':PLAC')) { |
|
883 | + if (str_starts_with($field_name, 'FAM:') && str_ends_with($field_name, ':PLAC')) { |
|
884 | 884 | foreach ($individual->spouseFamilies() as $family) { |
885 | 885 | foreach ($family->facts([$parts[1]]) as $fact) { |
886 | 886 | if (preg_match($regex, $fact->place()->gedcomName())) { |
@@ -198,9 +198,9 @@ |
||
198 | 198 | }; |
199 | 199 | |
200 | 200 | return $default_facts |
201 | - ->reject(fn (string $field): bool => array_key_exists($field, $fields)) |
|
201 | + ->reject(fn(string $field): bool => array_key_exists($field, $fields)) |
|
202 | 202 | ->sort($comparator) |
203 | - ->mapWithKeys(fn (string $fact): array => [$fact => Registry::elementFactory()->make($fact)->label()]) |
|
203 | + ->mapWithKeys(fn(string $fact): array => [$fact => Registry::elementFactory()->make($fact)->label()]) |
|
204 | 204 | ->all(); |
205 | 205 | } |
206 | 206 |