@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | private const SCHEMA_TARGET_VERSION = 3; |
| 54 | 54 | private const SCHEMA_SETTING_NAME = 'MAJ_SOSA_SCHEMA_VERSION'; |
| 55 | - private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema'; |
|
| 55 | + private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__.'\Schema'; |
|
| 56 | 56 | /** |
| 57 | 57 | * {@inheritDoc} |
| 58 | 58 | * @see \Fisharebest\Webtrees\Module\AbstractModule::title() |
@@ -92,20 +92,20 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function loadRoutes(Map $router): void |
| 94 | 94 | { |
| 95 | - $router->attach('', '', static function (Map $router): void { |
|
| 95 | + $router->attach('', '', static function(Map $router): void { |
|
| 96 | 96 | |
| 97 | - $router->attach('', '/module-maj/sosa', static function (Map $router): void { |
|
| 97 | + $router->attach('', '/module-maj/sosa', static function(Map $router): void { |
|
| 98 | 98 | |
| 99 | - $router->attach('', '/list', static function (Map $router): void { |
|
| 99 | + $router->attach('', '/list', static function(Map $router): void { |
|
| 100 | 100 | |
| 101 | 101 | |
| 102 | 102 | $router->get(AncestorsList::class, '/ancestors/{tree}{/gen}', AncestorsList::class); |
| 103 | - $router->get(AncestorsListIndividual::class, '/ancestors/{tree}/{gen}/tab/individuals', AncestorsListIndividual::class); //phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 104 | - $router->get(AncestorsListFamily::class, '/ancestors/{tree}/{gen}/tab/families', AncestorsListFamily::class); //phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 103 | + $router->get(AncestorsListIndividual::class, '/ancestors/{tree}/{gen}/tab/individuals', AncestorsListIndividual::class); //phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 104 | + $router->get(AncestorsListFamily::class, '/ancestors/{tree}/{gen}/tab/families', AncestorsListFamily::class); //phpcs:ignore Generic.Files.LineLength.TooLong |
|
| 105 | 105 | $router->get(MissingAncestorsList::class, '/missing/{tree}{/gen}', MissingAncestorsList::class); |
| 106 | 106 | }); |
| 107 | 107 | $router->get(SosaStatistics::class, '/statistics/{tree}', SosaStatistics::class); |
| 108 | - $router->attach('', '/config/{tree}', static function (Map $router): void { |
|
| 108 | + $router->attach('', '/config/{tree}', static function(Map $router): void { |
|
| 109 | 109 | |
| 110 | 110 | |
| 111 | 111 | $router->get(SosaConfig::class, '', SosaConfig::class); |
@@ -205,6 +205,6 @@ discard block |
||
| 205 | 205 | */ |
| 206 | 206 | public function headContent(): string |
| 207 | 207 | { |
| 208 | - return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">'; |
|
| 208 | + return '<link rel="stylesheet" href="'.e($this->moduleCssUrl()).'">'; |
|
| 209 | 209 | } |
| 210 | 210 | } |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | $params = $request->getParsedBody(); |
| 58 | 58 | assert(is_array($params)); |
| 59 | 59 | |
| 60 | - $user_id = (int) $params['sosa-userid']; |
|
| 60 | + $user_id = (int)$params['sosa-userid']; |
|
| 61 | 61 | $root_id = $params['sosa-rootid'] ?? ''; |
| 62 | 62 | |
| 63 | 63 | if (Auth::id() == $user_id || ($user_id == -1 && Auth::isManager($tree))) { |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | $user = Auth::check() ? $request->getAttribute('user') : new DefaultUser(); |
| 80 | 80 | |
| 81 | - $current_gen = (int) ($request->getAttribute('gen') ?? $request->getQueryParams()['gen'] ?? 0); |
|
| 81 | + $current_gen = (int)($request->getAttribute('gen') ?? $request->getQueryParams()['gen'] ?? 0); |
|
| 82 | 82 | |
| 83 | 83 | if ($current_gen <= 0) { |
| 84 | 84 | return response('Invalid generation', StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY); |
@@ -88,14 +88,14 @@ discard block |
||
| 88 | 88 | $nb_families_all = $list_families->count(); |
| 89 | 89 | |
| 90 | 90 | /** @var \Illuminate\Support\Collection<int, \Fisharebest\Webtrees\Family> $list_families */ |
| 91 | - $list_families = $list_families->mapWithKeys(function (stdClass $value) use ($tree): ?array { |
|
| 91 | + $list_families = $list_families->mapWithKeys(function(stdClass $value) use ($tree): ?array { |
|
| 92 | 92 | $fam = Registry::familyFactory()->make($value->f_id, $tree); |
| 93 | - return ($fam !== null && $fam->canShow()) ? [(int) $value->majs_sosa => $fam] : null; |
|
| 93 | + return ($fam !== null && $fam->canShow()) ? [(int)$value->majs_sosa => $fam] : null; |
|
| 94 | 94 | })->filter(); |
| 95 | 95 | |
| 96 | 96 | $nb_families_shown = $list_families->count(); |
| 97 | 97 | |
| 98 | - return $this->viewResponse($this->module->name() . '::list-ancestors-fam-tab', [ |
|
| 98 | + return $this->viewResponse($this->module->name().'::list-ancestors-fam-tab', [ |
|
| 99 | 99 | 'module_name' => $this->module->name(), |
| 100 | 100 | 'title' => I18N::translate('Sosa Ancestors'), |
| 101 | 101 | 'tree' => $tree, |
@@ -80,19 +80,19 @@ discard block |
||
| 80 | 80 | /** @var SosaStatisticsService $sosa_stats_service */ |
| 81 | 81 | $sosa_stats_service = app()->makeWith(SosaStatisticsService::class, ['tree' => $tree, 'user' => $user]); |
| 82 | 82 | |
| 83 | - $current_gen = (int) ($request->getAttribute('gen') ?? $request->getQueryParams()['gen'] ?? 0); |
|
| 83 | + $current_gen = (int)($request->getAttribute('gen') ?? $request->getQueryParams()['gen'] ?? 0); |
|
| 84 | 84 | |
| 85 | 85 | $list_missing = $this->sosa_record_service->listMissingAncestorsAtGeneration($tree, $user, $current_gen); |
| 86 | - $nb_missing_diff = $list_missing->sum(function (stdClass $value): int { |
|
| 86 | + $nb_missing_diff = $list_missing->sum(function(stdClass $value): int { |
|
| 87 | 87 | return ($value->majs_fat_id === null ? 1 : 0) + ($value->majs_mot_id === null ? 1 : 0); |
| 88 | 88 | }); |
| 89 | 89 | |
| 90 | - $list_missing = $list_missing->map(function (stdClass $value) use ($tree): ?MissingAncestor { |
|
| 90 | + $list_missing = $list_missing->map(function(stdClass $value) use ($tree): ?MissingAncestor { |
|
| 91 | 91 | $indi = Registry::individualFactory()->make($value->majs_i_id, $tree); |
| 92 | 92 | if ($indi !== null && $indi->canShowName()) { |
| 93 | 93 | return new MissingAncestor( |
| 94 | 94 | $indi, |
| 95 | - (int) $value->majs_sosa, |
|
| 95 | + (int)$value->majs_sosa, |
|
| 96 | 96 | $value->majs_fat_id === null, |
| 97 | 97 | $value->majs_mot_id === null |
| 98 | 98 | ); |
@@ -100,11 +100,11 @@ discard block |
||
| 100 | 100 | return null; |
| 101 | 101 | })->filter(); |
| 102 | 102 | |
| 103 | - $nb_missing_shown = $list_missing->sum(function (MissingAncestor $value): int { |
|
| 103 | + $nb_missing_shown = $list_missing->sum(function(MissingAncestor $value): int { |
|
| 104 | 104 | return ($value->isFatherMissing() ? 1 : 0) + ($value->isMotherMissing() ? 1 : 0); |
| 105 | 105 | }); |
| 106 | 106 | |
| 107 | - return $this->viewResponse($this->module->name() . '::list-missing-page', [ |
|
| 107 | + return $this->viewResponse($this->module->name().'::list-missing-page', [ |
|
| 108 | 108 | 'module_name' => $this->module->name(), |
| 109 | 109 | 'title' => I18N::translate('Missing Ancestors'), |
| 110 | 110 | 'tree' => $tree, |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | $user = Auth::check() ? $request->getAttribute('user') : new DefaultUser(); |
| 80 | 80 | |
| 81 | - $current_gen = (int) ($request->getAttribute('gen') ?? $request->getQueryParams()['gen'] ?? 0); |
|
| 81 | + $current_gen = (int)($request->getAttribute('gen') ?? $request->getQueryParams()['gen'] ?? 0); |
|
| 82 | 82 | |
| 83 | 83 | if ($current_gen <= 0) { |
| 84 | 84 | return response('Invalid generation', StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY); |
@@ -88,14 +88,14 @@ discard block |
||
| 88 | 88 | $nb_ancestors_all = $list_ancestors->count(); |
| 89 | 89 | |
| 90 | 90 | /** @var \Illuminate\Support\Collection<int, \Fisharebest\Webtrees\Individual> $list_ancestors */ |
| 91 | - $list_ancestors = $list_ancestors->mapWithKeys(function (stdClass $value) use ($tree): ?array { |
|
| 91 | + $list_ancestors = $list_ancestors->mapWithKeys(function(stdClass $value) use ($tree): ?array { |
|
| 92 | 92 | $indi = Registry::individualFactory()->make($value->majs_i_id, $tree); |
| 93 | - return ($indi !== null && $indi->canShowName()) ? [(int) $value->majs_sosa => $indi] : null; |
|
| 93 | + return ($indi !== null && $indi->canShowName()) ? [(int)$value->majs_sosa => $indi] : null; |
|
| 94 | 94 | })->filter(); |
| 95 | 95 | |
| 96 | 96 | $nb_ancestors_shown = $list_ancestors->count(); |
| 97 | 97 | |
| 98 | - return $this->viewResponse($this->module->name() . '::list-ancestors-indi-tab', [ |
|
| 98 | + return $this->viewResponse($this->module->name().'::list-ancestors-indi-tab', [ |
|
| 99 | 99 | 'module_name' => $this->module->name(), |
| 100 | 100 | 'title' => I18N::translate('Sosa Ancestors'), |
| 101 | 101 | 'tree' => $tree, |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | $tree = $request->getAttribute('tree'); |
| 61 | 61 | assert($tree instanceof Tree); |
| 62 | 62 | |
| 63 | - return response(view($this->module->name() . '::modals/sosa-compute', [ |
|
| 63 | + return response(view($this->module->name().'::modals/sosa-compute', [ |
|
| 64 | 64 | 'tree' => $tree, |
| 65 | 65 | 'xref' => $request->getAttribute('xref') |
| 66 | 66 | ])); |
@@ -58,14 +58,14 @@ discard block |
||
| 58 | 58 | $params = $request->getParsedBody(); |
| 59 | 59 | assert(is_array($params)); |
| 60 | 60 | |
| 61 | - $user_id = (int) ($params['user_id'] ?? Auth::id() ?? 0); |
|
| 61 | + $user_id = (int)($params['user_id'] ?? Auth::id() ?? 0); |
|
| 62 | 62 | $partial_from = $params['partial_from'] ?? null; |
| 63 | 63 | |
| 64 | 64 | if (($user_id == -1 && Auth::isManager($tree)) || Auth::id() == $user_id) { |
| 65 | 65 | $user = $user_id == -1 ? new DefaultUser() : $this->user_service->find($user_id); |
| 66 | 66 | |
| 67 | 67 | /** @var SosaCalculatorService $sosa_calc_service */ |
| 68 | - $sosa_calc_service = app()->makeWith(SosaCalculatorService::class, [ 'tree' => $tree, 'user' => $user]); |
|
| 68 | + $sosa_calc_service = app()->makeWith(SosaCalculatorService::class, ['tree' => $tree, 'user' => $user]); |
|
| 69 | 69 | |
| 70 | 70 | if ( |
| 71 | 71 | $partial_from !== null && |
@@ -77,8 +77,7 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | return $res ? |
| 80 | - response('', 200) : |
|
| 81 | - response( |
|
| 80 | + response('', 200) : response( |
|
| 82 | 81 | I18N::translate('An error occurred while computing Sosa ancestors.'), |
| 83 | 82 | StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR |
| 84 | 83 | ); |
@@ -76,12 +76,12 @@ |
||
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - return $this->viewResponse($this->module->name() . '::config-page', [ |
|
| 79 | + return $this->viewResponse($this->module->name().'::config-page', [ |
|
| 80 | 80 | 'module_name' => $this->module->name(), |
| 81 | 81 | 'title' => I18N::translate('Sosa Configuration'), |
| 82 | 82 | 'tree' => $tree, |
| 83 | 83 | 'user_id' => $request->getAttribute('user'), |
| 84 | - 'selected_user_id' => (int) ($request->getQueryParams()['user_id'] ?? 0), |
|
| 84 | + 'selected_user_id' => (int)($request->getQueryParams()['user_id'] ?? 0), |
|
| 85 | 85 | 'immediate_compute' => ($request->getQueryParams()['compute'] ?? '') == 'yes', |
| 86 | 86 | 'users_root' => $users_root |
| 87 | 87 | ]); |
@@ -77,9 +77,9 @@ |
||
| 77 | 77 | /** @var SosaStatisticsService $sosa_stats_service */ |
| 78 | 78 | $sosa_stats_service = app()->makeWith(SosaStatisticsService::class, ['tree' => $tree, 'user' => $user]); |
| 79 | 79 | |
| 80 | - $current_gen = (int) ($request->getAttribute('gen') ?? $request->getQueryParams()['gen'] ?? 0); |
|
| 80 | + $current_gen = (int)($request->getAttribute('gen') ?? $request->getQueryParams()['gen'] ?? 0); |
|
| 81 | 81 | |
| 82 | - return $this->viewResponse($this->module->name() . '::list-ancestors-page', [ |
|
| 82 | + return $this->viewResponse($this->module->name().'::list-ancestors-page', [ |
|
| 83 | 83 | 'module_name' => $this->module->name(), |
| 84 | 84 | 'title' => I18N::translate('Sosa Ancestors'), |
| 85 | 85 | 'tree' => $tree, |