Passed
Pull Request — main (#3985)
by Jonathan
20:03
created
app/Functions/FunctionsPrintFacts.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -432,10 +432,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 {
Please login to merge, or discard this patch.
app/Services/SearchService.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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())) {
Please login to merge, or discard this patch.
app/Http/RequestHandlers/SearchAdvancedPage.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -198,9 +198,9 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
app/Http/RequestHandlers/SearchReplaceAction.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@
 block discarded – undo
93 93
 
94 94
             case 'name':
95 95
                 $name_tags = Registry::elementFactory()->make('INDI:NAME')->subtags();
96
-                $name_tags = array_map(fn (string $tag): string => '2 ' . $tag, $name_tags);
96
+                $name_tags = array_map(fn(string $tag): string => '2 ' . $tag, $name_tags);
97 97
                 $name_tags[] = '1 NAME';
98 98
 
99 99
                 $records = $this->search_service->searchIndividuals([$tree], [$search]);
Please login to merge, or discard this patch.
app/Http/RequestHandlers/AutoCompleteFolder.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
 
57 57
         try {
58 58
             return $this->media_file_service->mediaFolders($tree)
59
-                ->filter(fn (string $path): bool => stripos($path, $query) !== false);
59
+                ->filter(fn(string $path): bool => stripos($path, $query) !== false);
60 60
         } catch (FilesystemException $ex) {
61 61
             return new Collection();
62 62
         }
Please login to merge, or discard this patch.
app/Services/MediaFileService.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         $sizePostMax = $this->parseIniFileSize(ini_get('post_max_size'));
99 99
         $sizeUploadMax = $this->parseIniFileSize(ini_get('upload_max_filesize'));
100 100
 
101
-        $bytes =  min($sizePostMax, $sizeUploadMax);
101
+        $bytes = min($sizePostMax, $sizeUploadMax);
102 102
         $kb    = intdiv($bytes + 1023, 1024);
103 103
 
104 104
         return I18N::translate('%s KB', I18N::number($kb));
@@ -297,9 +297,9 @@  discard block
 block discarded – undo
297 297
         try {
298 298
             $files = $filesystem
299 299
                 ->listContents($folder, $subfolders)
300
-                ->filter(fn (StorageAttributes $attributes): bool => $attributes->isFile())
301
-                ->filter(fn (StorageAttributes $attributes): bool => !$this->ignorePath($attributes->path()))
302
-                ->map(fn (StorageAttributes $attributes): string => $attributes->path())
300
+                ->filter(fn(StorageAttributes $attributes): bool => $attributes->isFile())
301
+                ->filter(fn(StorageAttributes $attributes): bool => !$this->ignorePath($attributes->path()))
302
+                ->map(fn(StorageAttributes $attributes): string => $attributes->path())
303 303
                 ->toArray();
304 304
         } catch (FilesystemException $ex) {
305 305
             $files = [];
@@ -347,9 +347,9 @@  discard block
 block discarded – undo
347 347
     {
348 348
         $folders = Registry::filesystem()->media($tree)
349 349
             ->listContents('', Filesystem::LIST_DEEP)
350
-            ->filter(fn (StorageAttributes $attributes): bool => $attributes->isDir())
351
-            ->filter(fn (StorageAttributes $attributes): bool => !$this->ignorePath($attributes->path()))
352
-            ->map(fn (StorageAttributes $attributes): string => $attributes->path())
350
+            ->filter(fn(StorageAttributes $attributes): bool => $attributes->isDir())
351
+            ->filter(fn(StorageAttributes $attributes): bool => !$this->ignorePath($attributes->path()))
352
+            ->map(fn(StorageAttributes $attributes): string => $attributes->path())
353 353
             ->toArray();
354 354
 
355 355
         return new Collection($folders);
@@ -394,9 +394,9 @@  discard block
 block discarded – undo
394 394
         foreach ($media_roots as $media_folder) {
395 395
             $tmp = $data_filesystem
396 396
                 ->listContents($media_folder, Filesystem::LIST_DEEP)
397
-                ->filter(fn (StorageAttributes $attributes): bool => $attributes->isDir())
398
-                ->filter(fn (StorageAttributes $attributes): bool => !$this->ignorePath($attributes->path()))
399
-                ->map(fn (StorageAttributes $attributes): string => $attributes->path() . '/')
397
+                ->filter(fn(StorageAttributes $attributes): bool => $attributes->isDir())
398
+                ->filter(fn(StorageAttributes $attributes): bool => !$this->ignorePath($attributes->path()))
399
+                ->map(fn(StorageAttributes $attributes): string => $attributes->path() . '/')
400 400
                 ->toArray();
401 401
 
402 402
             $disk_folders = $disk_folders->concat($tmp);
Please login to merge, or discard this patch.
app/Services/GedcomEditService.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -438,12 +438,12 @@  discard block
 block discarded – undo
438 438
     {
439 439
         $subtags = Registry::elementFactory()->make($record->tag())->subtags();
440 440
 
441
-        $subtags = array_filter($subtags, fn (string $v, string $k) => !str_ends_with($v, ':1') || $record->facts([$k])->isEmpty(), ARRAY_FILTER_USE_BOTH);
441
+        $subtags = array_filter($subtags, fn(string $v, string $k) => !str_ends_with($v, ':1') || $record->facts([$k])->isEmpty(), ARRAY_FILTER_USE_BOTH);
442 442
 
443 443
         $subtags = array_keys($subtags);
444 444
 
445 445
         if (!$include_hidden) {
446
-            $fn_hidden = fn (string $t): bool => !$this->isHiddenTag($record->tag() . ':' . $t);
446
+            $fn_hidden = fn(string $t): bool => !$this->isHiddenTag($record->tag() . ':' . $t);
447 447
             $subtags   = array_filter($subtags, $fn_hidden);
448 448
         }
449 449
 
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
     private function isHiddenTag(string $tag): bool
537 537
     {
538 538
         // Function to filter hidden tags.
539
-        $fn_hide = fn (string $x): bool => (bool) Site::getPreference('HIDE_' . $x);
539
+        $fn_hide = fn(string $x): bool => (bool) Site::getPreference('HIDE_' . $x);
540 540
 
541 541
         $preferences = array_filter(Gedcom::HIDDEN_TAGS, $fn_hide, ARRAY_FILTER_USE_KEY);
542 542
         $preferences = array_values($preferences);
Please login to merge, or discard this patch.
app/Functions/FunctionsPrint.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
                     if ($note->canShow()) {
162 162
                         $noterec = $note->gedcom();
163 163
                         $nt      = preg_match("/0 @$nmatch[1]@ NOTE (.*)/", $noterec, $n1match);
164
-                        $data    .= self::printNoteRecord($tree, $nt > 0 ? $n1match[1] : '', 1, $noterec);
164
+                        $data .= self::printNoteRecord($tree, $nt > 0 ? $n1match[1] : '', 1, $noterec);
165 165
                     }
166 166
                 } else {
167 167
                     $data = '<div class="fact_NOTE"><span class="label">' . I18N::translate('Note') . '</span>: <span class="field error">' . $nmatch[1] . '</span></div>';
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
                 if (preg_match_all('/\n3 (?:_HEB|ROMN) (.+)/', $placerec, $matches)) {
380 380
                     foreach ($matches[1] as $match) {
381 381
                         $wt_place = new Place($match, $tree);
382
-                        $html     .= ' - ' . $wt_place->fullName();
382
+                        $html .= ' - ' . $wt_place->fullName();
383 383
                     }
384 384
                 }
385 385
 
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
                     // Links to external maps
394 394
                     $html .= app(ModuleService::class)
395 395
                         ->findByInterface(ModuleMapLinkInterface::class)
396
-                        ->map(fn (ModuleMapLinkInterface $module): string => ' ' . $module->mapLink($event))
396
+                        ->map(fn(ModuleMapLinkInterface $module): string => ' ' . $module->mapLink($event))
397 397
                         ->implode('');
398 398
                 }
399 399
 
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
                 $quick_facts  = explode(',', $tree->getPreference('INDI_FACTS_QUICK'));
441 441
                 $unique_facts = [
442 442
                     'ADOP',
443
-                    'AFN' ,
443
+                    'AFN',
444 444
                     'BAPL',
445 445
                     'BAPM',
446 446
                     'BARM',
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
                     'BURI',
450 450
                     'CAST',
451 451
                     'CHAN',
452
-                    'CHR' ,
452
+                    'CHR',
453 453
                     'CHRA',
454 454
                     'CONF',
455 455
                     'CONL',
@@ -459,18 +459,18 @@  discard block
 block discarded – undo
459 459
                     'FCOM',
460 460
                     'GRAD',
461 461
                     'NCHI',
462
-                    'NMR' ,
462
+                    'NMR',
463 463
                     'ORDN',
464 464
                     'PROB',
465 465
                     'REFN',
466 466
                     'RELI',
467 467
                     'RESN',
468 468
                     'RETI',
469
-                    'RFN' ,
470
-                    'RIN' ,
471
-                    'SEX' ,
469
+                    'RFN',
470
+                    'RIN',
471
+                    'SEX',
472 472
                     'SLGC',
473
-                    'SSN' ,
473
+                    'SSN',
474 474
                     'WILL',
475 475
                 ];
476 476
                 break;
@@ -492,13 +492,13 @@  discard block
 block discarded – undo
492 492
         }
493 493
 
494 494
         // Filter existing tags
495
-        $filter_fn = fn ($tag): bool => !in_array($tag, $unique_facts, true) || $record->facts([$tag])->isEmpty();
495
+        $filter_fn = fn($tag): bool => !in_array($tag, $unique_facts, true) || $record->facts([$tag])->isEmpty();
496 496
 
497 497
         $quick_facts = array_filter($quick_facts, $filter_fn);
498 498
 
499 499
 
500 500
         // Create a label for a subtag
501
-        $label_fn = fn ($subtag): string => Registry::elementFactory()->make($record->tag() . ':' . $subtag)->label();
501
+        $label_fn = fn($subtag): string => Registry::elementFactory()->make($record->tag() . ':' . $subtag)->label();
502 502
 
503 503
         $quick_facts = array_combine($quick_facts, array_map($label_fn, $quick_facts));
504 504
         $add_facts   = array_combine($add_facts, array_map($label_fn, $add_facts));
Please login to merge, or discard this patch.