@@ -54,7 +54,7 @@ |
||
54 | 54 | throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
55 | 55 | } |
56 | 56 | |
57 | - return $this->viewResponse($this->module->name() . '::admin/config', [ |
|
57 | + return $this->viewResponse($this->module->name().'::admin/config', [ |
|
58 | 58 | 'module' => $this->module, |
59 | 59 | 'title' => $this->module->title() |
60 | 60 | ]); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | public function boot(): void |
68 | 68 | { |
69 | 69 | $this->traitBoot(); |
70 | - View::registerCustomView('::modules/privacy-policy/page', $this->name() . '::privacy-policy'); |
|
70 | + View::registerCustomView('::modules/privacy-policy/page', $this->name().'::privacy-policy'); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function loadRoutes(Map $router): void |
78 | 78 | { |
79 | - $router->attach('', '', static function (Map $router): void { |
|
79 | + $router->attach('', '', static function(Map $router): void { |
|
80 | 80 | |
81 | - $router->attach('', '/module-maj/misc', static function (Map $router): void { |
|
81 | + $router->attach('', '/module-maj/misc', static function(Map $router): void { |
|
82 | 82 | |
83 | - $router->attach('', '/config/admin', static function (Map $router): void { |
|
83 | + $router->attach('', '/config/admin', static function(Map $router): void { |
|
84 | 84 | |
85 | 85 | $router->get(AdminConfigPage::class, '', AdminConfigPage::class); |
86 | 86 | $router->post(AdminConfigAction::class, '', AdminConfigAction::class); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | public function listSubscribedHooks(): array |
115 | 115 | { |
116 | 116 | return [ |
117 | - app()->makeWith(TitlesCardHook::class, [ 'module' => $this ]) |
|
117 | + app()->makeWith(TitlesCardHook::class, ['module' => $this]) |
|
118 | 118 | ]; |
119 | 119 | } |
120 | 120 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function boot(): void |
35 | 35 | { |
36 | - View::registerNamespace($this->name(), $this->resourcesFolder() . 'views/'); |
|
36 | + View::registerNamespace($this->name(), $this->resourcesFolder().'views/'); |
|
37 | 37 | |
38 | 38 | $this->loadRoutes(app(RouterContainer::class)->getMap()); |
39 | 39 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function resourcesFolder(): string |
45 | 45 | { |
46 | - return Webtrees::MODULES_DIR . trim($this->name(), '_') . '/resources/'; |
|
46 | + return Webtrees::MODULES_DIR.trim($this->name(), '_').'/resources/'; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function customTranslations(string $language): array |
71 | 71 | { |
72 | - $translation_file = $this->resourcesFolder() . 'lang/' . $language . '/messages.php'; |
|
72 | + $translation_file = $this->resourcesFolder().'lang/'.$language.'/messages.php'; |
|
73 | 73 | |
74 | 74 | try { |
75 | 75 | $translation = new Translation($translation_file); |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | { |
95 | 95 | /** @var ModuleThemeInterface $theme */ |
96 | 96 | $theme = app(ModuleThemeInterface::class); |
97 | - $css_file = $this->resourcesFolder() . 'css/' . $theme->name() . '.min.css'; |
|
97 | + $css_file = $this->resourcesFolder().'css/'.$theme->name().'.min.css'; |
|
98 | 98 | |
99 | 99 | if (file_exists($css_file)) { |
100 | - return $this->assetUrl('css/' . $theme->name() . '.min.css'); |
|
100 | + return $this->assetUrl('css/'.$theme->name().'.min.css'); |
|
101 | 101 | } else { |
102 | 102 | return $this->assetUrl('css/default.min.css'); |
103 | 103 | } |
@@ -69,7 +69,7 @@ |
||
69 | 69 | $record instanceof Individual && |
70 | 70 | $this->sosa_records_service->isSosa($record->tree(), Auth::user(), $record) |
71 | 71 | ) { |
72 | - return view($this->module->name() . '::icons/sosa', [ 'size_style' => $size ]); |
|
72 | + return view($this->module->name().'::icons/sosa', ['size_style' => $size]); |
|
73 | 73 | } |
74 | 74 | return ''; |
75 | 75 | } |
@@ -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') ?? 0); |
|
81 | + $current_gen = (int)($request->getAttribute('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, |
@@ -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->getQueryParams()['gen'] ?? $request->getAttribute('gen') ?? 0); |
|
83 | + $current_gen = (int)($request->getQueryParams()['gen'] ?? $request->getAttribute('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') ?? 0); |
|
81 | + $current_gen = (int)($request->getAttribute('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, |
@@ -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->getQueryParams()['gen'] ?? $request->getAttribute('gen') ?? 0); |
|
80 | + $current_gen = (int)($request->getQueryParams()['gen'] ?? $request->getAttribute('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, |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | /** @var SosaStatisticsService $sosa_stats_service */ |
72 | 72 | $sosa_stats_service = app()->makeWith(SosaStatisticsService::class, ['tree' => $tree, 'user' => $user]); |
73 | 73 | |
74 | - return $this->viewResponse($this->module->name() . '::statistics-page', [ |
|
74 | + return $this->viewResponse($this->module->name().'::statistics-page', [ |
|
75 | 75 | 'module_name' => $this->module->name(), |
76 | 76 | 'title' => I18N::translate('Sosa Statistics'), |
77 | 77 | 'tree' => $tree, |
@@ -126,37 +126,34 @@ discard block |
||
126 | 126 | |
127 | 127 | foreach ($stats_by_gen as $gen => $stats_gen) { |
128 | 128 | $gen_diff = $gen > 1 ? |
129 | - (int) $stats_gen['diffSosaTotalCount'] - (int) $stats_by_gen[$gen - 1]['diffSosaTotalCount'] : |
|
130 | - 1; |
|
129 | + (int)$stats_gen['diffSosaTotalCount'] - (int)$stats_by_gen[$gen - 1]['diffSosaTotalCount'] : 1; |
|
131 | 130 | $generation_stats[$gen] = array( |
132 | - 'gen_min_birth' => $stats_gen['firstBirth'] ?? (int) $stats_gen['firstEstimatedBirth'], |
|
133 | - 'gen_max_birth' => $stats_gen['lastBirth'] ?? (int) $stats_gen['lastEstimatedBirth'], |
|
131 | + 'gen_min_birth' => $stats_gen['firstBirth'] ?? (int)$stats_gen['firstEstimatedBirth'], |
|
132 | + 'gen_max_birth' => $stats_gen['lastBirth'] ?? (int)$stats_gen['lastEstimatedBirth'], |
|
134 | 133 | 'theoretical' => BigInteger::of(2)->power($gen - 1)->toInt(), |
135 | - 'known' => (int) $stats_gen['sosaCount'], |
|
134 | + 'known' => (int)$stats_gen['sosaCount'], |
|
136 | 135 | 'perc_known' => $this->safeDivision( |
137 | - BigInteger::of((int) $stats_gen['sosaCount']), |
|
136 | + BigInteger::of((int)$stats_gen['sosaCount']), |
|
138 | 137 | BigInteger::of(2)->power($gen - 1) |
139 | 138 | ), |
140 | 139 | 'missing' => $gen > 1 ? |
141 | - 2 * (int) $stats_by_gen[$gen - 1]['sosaCount'] - (int) $stats_gen['sosaCount'] : |
|
142 | - 0, |
|
140 | + 2 * (int)$stats_by_gen[$gen - 1]['sosaCount'] - (int)$stats_gen['sosaCount'] : 0, |
|
143 | 141 | 'perc_missing' => $gen > 1 ? |
144 | 142 | 1 - $this->safeDivision( |
145 | - BigInteger::of((int) $stats_gen['sosaCount']), |
|
146 | - BigInteger::of(2 * (int) $stats_by_gen[$gen - 1]['sosaCount']) |
|
147 | - ) : |
|
148 | - 0, |
|
149 | - 'total_known' => (int) $stats_gen['sosaTotalCount'], |
|
143 | + BigInteger::of((int)$stats_gen['sosaCount']), |
|
144 | + BigInteger::of(2 * (int)$stats_by_gen[$gen - 1]['sosaCount']) |
|
145 | + ) : 0, |
|
146 | + 'total_known' => (int)$stats_gen['sosaTotalCount'], |
|
150 | 147 | 'perc_total_known' => $this->safeDivision( |
151 | - BigInteger::of((int) $stats_gen['sosaTotalCount']), |
|
148 | + BigInteger::of((int)$stats_gen['sosaTotalCount']), |
|
152 | 149 | BigInteger::of(2)->power($gen)->minus(1) |
153 | 150 | ), |
154 | 151 | 'different' => $gen_diff, |
155 | 152 | 'perc_different' => $this->safeDivision( |
156 | 153 | BigInteger::of($gen_diff), |
157 | - BigInteger::of((int) $stats_gen['sosaCount']) |
|
154 | + BigInteger::of((int)$stats_gen['sosaCount']) |
|
158 | 155 | ), |
159 | - 'total_different' => (int) $stats_gen['diffSosaTotalCount'] |
|
156 | + 'total_different' => (int)$stats_gen['diffSosaTotalCount'] |
|
160 | 157 | ); |
161 | 158 | } |
162 | 159 |