@@ -34,7 +34,7 @@ |
||
| 34 | 34 | DB::schema()->drop('maj_hooks'); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - DB::schema()->create('maj_hook_order', static function (Blueprint $table): void { |
|
| 37 | + DB::schema()->create('maj_hook_order', static function(Blueprint $table): void { |
|
| 38 | 38 | $table->string('majho_module_name', 32); |
| 39 | 39 | $table->string('majho_hook_name', 64); |
| 40 | 40 | $table->integer('majho_hook_order')->nullable(); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function all(bool $include_disabled = false): Collection |
| 76 | 76 | { |
| 77 | - return Registry::cache()->array()->remember('all-hooks', function () use ($include_disabled): Collection { |
|
| 77 | + return Registry::cache()->array()->remember('all-hooks', function() use ($include_disabled): Collection { |
|
| 78 | 78 | $hooks_info = DB::table('maj_hook_order') |
| 79 | 79 | ->get() |
| 80 | 80 | ->groupBy(['majho_hook_name', 'majho_module_name']); |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | ) as $hook_instance |
| 105 | 105 | ) { |
| 106 | 106 | $hook_module_info = $hook_info->get($hook_instance->module()->name(), collect())->first(); |
| 107 | - $hook_order = $hook_module_info instanceof stdClass ? (int) $hook_module_info->majho_hook_order : 0; |
|
| 107 | + $hook_order = $hook_module_info instanceof stdClass ? (int)$hook_module_info->majho_hook_order : 0; |
|
| 108 | 108 | $hook_collector->register($hook_instance, $hook_order); |
| 109 | 109 | } |
| 110 | 110 | } |
@@ -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 | ]); |
@@ -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 | } |
@@ -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 | |
@@ -67,10 +67,10 @@ |
||
| 67 | 67 | $sosa_stats_service = app()->makeWith(SosaStatisticsService::class, ['tree' => $tree, 'user' => $user]); |
| 68 | 68 | $pedi_collapse_data = $sosa_stats_service->pedigreeCollapseByGenerationData(); |
| 69 | 69 | |
| 70 | - $response = [ 'cells' => [] ]; |
|
| 70 | + $response = ['cells' => []]; |
|
| 71 | 71 | $last_pedi_collapse = 0; |
| 72 | 72 | foreach ($pedi_collapse_data as $gen => $rec) { |
| 73 | - $response['cells'][$gen] = view($this->module->name() . '::components/pedigree-collapse-cell', [ |
|
| 73 | + $response['cells'][$gen] = view($this->module->name().'::components/pedigree-collapse-cell', [ |
|
| 74 | 74 | 'pedi_collapse_roots' => $rec['pedi_collapse_roots'], |
| 75 | 75 | 'pedi_collapse_xgen' => $rec['pedi_collapse_xgen'] |
| 76 | 76 | ]); |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | // Clean up previous sosa table if it exists |
| 35 | 35 | DB::schema()->dropIfExists('maj_sosa'); |
| 36 | 36 | |
| 37 | - DB::schema()->create('maj_sosa', static function (Blueprint $table): void { |
|
| 37 | + DB::schema()->create('maj_sosa', static function(Blueprint $table): void { |
|
| 38 | 38 | |
| 39 | 39 | $table->integer('majs_gedcom_id'); |
| 40 | 40 | $table->integer('majs_user_id')->default(-1); |
@@ -74,8 +74,7 @@ |
||
| 74 | 74 | $this->tmp_sosa_table = array(); |
| 75 | 75 | $max_gen_setting = $tree->getUserPreference($user, 'MAJ_SOSA_MAX_GEN'); |
| 76 | 76 | $this->max_generations = is_numeric($max_gen_setting) ? |
| 77 | - (int) $max_gen_setting : |
|
| 78 | - $this->sosa_records_service->maxSystemGenerations(); |
|
| 77 | + (int)$max_gen_setting : $this->sosa_records_service->maxSystemGenerations(); |
|
| 79 | 78 | } |
| 80 | 79 | |
| 81 | 80 | /** |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | // How to update the database schema for this module |
| 77 | 77 | private const SCHEMA_TARGET_VERSION = 3; |
| 78 | 78 | private const SCHEMA_SETTING_NAME = 'MAJ_GEODISP_SCHEMA_VERSION'; |
| 79 | - private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema'; |
|
| 79 | + private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__.'\Schema'; |
|
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | 82 | * {@inheritDoc} |
@@ -126,13 +126,13 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | public function loadRoutes(Map $router): void |
| 128 | 128 | { |
| 129 | - $router->attach('', '', static function (Map $router): void { |
|
| 129 | + $router->attach('', '', static function(Map $router): void { |
|
| 130 | 130 | |
| 131 | - $router->attach('', '/module-maj/geodispersion', static function (Map $router): void { |
|
| 132 | - $router->attach('', '/admin', static function (Map $router): void { |
|
| 131 | + $router->attach('', '/module-maj/geodispersion', static function(Map $router): void { |
|
| 132 | + $router->attach('', '/admin', static function(Map $router): void { |
|
| 133 | 133 | $router->get(AdminConfigPage::class, '/config{/tree}', AdminConfigPage::class); |
| 134 | 134 | |
| 135 | - $router->attach('', '/analysis-views/{tree}', static function (Map $router): void { |
|
| 135 | + $router->attach('', '/analysis-views/{tree}', static function(Map $router): void { |
|
| 136 | 136 | $router->tokens(['view_id' => '\d+', 'enable' => '[01]']); |
| 137 | 137 | $router->extras([ |
| 138 | 138 | 'middleware' => [ |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | //phpcs:enable |
| 152 | 152 | }); |
| 153 | 153 | |
| 154 | - $router->attach('', '/map-adapters/{tree}', static function (Map $router): void { |
|
| 154 | + $router->attach('', '/map-adapters/{tree}', static function(Map $router): void { |
|
| 155 | 155 | $router->tokens(['adapter_id' => '\d+', 'view_id' => '\d+']); |
| 156 | 156 | $router->extras([ |
| 157 | 157 | 'middleware' => [ |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | $router->get(GeoAnalysisViewsList::class, '/list/{tree}', GeoAnalysisViewsList::class); |
| 178 | 178 | |
| 179 | - $router->attach('', '/analysisview/{tree}/{view_id}', static function (Map $router): void { |
|
| 179 | + $router->attach('', '/analysisview/{tree}/{view_id}', static function(Map $router): void { |
|
| 180 | 180 | $router->tokens(['view_id' => '\d+']); |
| 181 | 181 | $router->get(GeoAnalysisViewPage::class, '', GeoAnalysisViewPage::class); |
| 182 | 182 | $router->get(GeoAnalysisViewTabs::class, '/tabs', GeoAnalysisViewTabs::class); |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | */ |
| 215 | 215 | public function headContent(): string |
| 216 | 216 | { |
| 217 | - return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">'; |
|
| 217 | + return '<link rel="stylesheet" href="'.e($this->moduleCssUrl()).'">'; |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |