@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function loadRoutes(Map $router): void |
59 | 59 | { |
60 | - $router->attach('', '', static function (Map $router): void { |
|
60 | + $router->attach('', '', static function(Map $router): void { |
|
61 | 61 | |
62 | - $router->attach('', '/module-maj/welcomeblock/{block_id}', static function (Map $router): void { |
|
62 | + $router->attach('', '/module-maj/welcomeblock/{block_id}', static function(Map $router): void { |
|
63 | 63 | |
64 | 64 | $router->get(MatomoStats::class, '/matomostats', MatomoStats::class); |
65 | 65 | }); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $fab_login_block_view = app(\Fisharebest\Webtrees\Module\LoginBlockModule::class) |
88 | 88 | ->getBlock($tree, $block_id, ModuleBlockInterface::CONTEXT_EMBED); |
89 | 89 | |
90 | - $content = view($this->name() . '::block-embed', [ |
|
90 | + $content = view($this->name().'::block-embed', [ |
|
91 | 91 | 'block_id' => $block_id, |
92 | 92 | 'fab_welcome_block_view' => $fab_welcome_block_view, |
93 | 93 | 'fab_login_block_view' => $fab_login_block_view, |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function editBlockConfiguration(Tree $tree, int $block_id): string |
124 | 124 | { |
125 | - return view($this->name() . '::config', $this->matomoSettings($block_id)); |
|
125 | + return view($this->name().'::config', $this->matomoSettings($block_id)); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public function saveBlockConfiguration(ServerRequestInterface $request, int $block_id): void |
133 | 133 | { |
134 | - $params = (array) $request->getParsedBody(); |
|
134 | + $params = (array)$request->getParsedBody(); |
|
135 | 135 | |
136 | 136 | $matomo_enabled = $params['matomo_enabled'] == 'yes'; |
137 | 137 | $this->setBlockSetting($block_id, 'matomo_enabled', $matomo_enabled ? 'yes' : 'no'); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | ->setBlockSetting($block_id, 'matomo_token', trim($params['matomo_token'])) |
155 | 155 | ->setBlockSetting($block_id, 'matomo_siteid', $params['matomo_siteid']); |
156 | 156 | |
157 | - app('cache.files')->forget($this->name() . '-matomovisits-yearly-' . $block_id); |
|
157 | + app('cache.files')->forget($this->name().'-matomovisits-yearly-'.$block_id); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | 'matomo_enabled' => $this->isMatomoEnabled($block_id), |
181 | 181 | 'matomo_url' => $this->getBlockSetting($block_id, 'matomo_url'), |
182 | 182 | 'matomo_token' => $this->getBlockSetting($block_id, 'matomo_token'), |
183 | - 'matomo_siteid' => (int) $this->getBlockSetting($block_id, 'matomo_siteid', '0') |
|
183 | + 'matomo_siteid' => (int)$this->getBlockSetting($block_id, 'matomo_siteid', '0') |
|
184 | 184 | ]; |
185 | 185 | } |
186 | 186 | } |
@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | $cache = Registry::cache()->file(); |
44 | 44 | |
45 | 45 | return $cache->remember( |
46 | - $module->name() . '-matomovisits-yearly-' . $block_id, |
|
47 | - function () use ($module, $block_id): ?int { |
|
46 | + $module->name().'-matomovisits-yearly-'.$block_id, |
|
47 | + function() use ($module, $block_id): ?int { |
|
48 | 48 | $visits_year = $this->visits($module, $block_id, 'year'); |
49 | 49 | if ($visits_year === null) { |
50 | 50 | return null; |
51 | 51 | } |
52 | - $visits_today = (int) $this->visits($module, $block_id, 'day'); |
|
52 | + $visits_today = (int)$this->visits($module, $block_id, 'day'); |
|
53 | 53 | |
54 | 54 | return $visits_year - $visits_today; |
55 | 55 | }, |
@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | public function visitsToday(WelcomeBlockModule $module, int $block_id): ?int |
68 | 68 | { |
69 | 69 | return app('cache.array')->remember( |
70 | - $module->name() . '-matomovisits-daily-' . $block_id, |
|
71 | - function () use ($module, $block_id): ?int { |
|
70 | + $module->name().'-matomovisits-daily-'.$block_id, |
|
71 | + function() use ($module, $block_id) : ?int { |
|
72 | 72 | return $this->visits($module, $block_id, 'day'); |
73 | 73 | } |
74 | 74 | ); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | ]); |
111 | 111 | |
112 | 112 | if ($response->getStatusCode() === StatusCodeInterface::STATUS_OK) { |
113 | - $result = json_decode((string) $response->getBody(), true)['value'] ?? null; |
|
113 | + $result = json_decode((string)$response->getBody(), true)['value'] ?? null; |
|
114 | 114 | if ($result !== null) { |
115 | 115 | return (int)$result; |
116 | 116 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | //How to update the database schema for this module |
52 | 52 | private const SCHEMA_TARGET_VERSION = 2; |
53 | 53 | private const SCHEMA_SETTING_NAME = 'MAJ_ADMTASKS_SCHEMA_VERSION'; |
54 | - private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema'; |
|
54 | + private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__.'\Schema'; |
|
55 | 55 | |
56 | 56 | /** |
57 | 57 | * {@inheritDoc} |
@@ -91,11 +91,11 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function loadRoutes(Map $router): void |
93 | 93 | { |
94 | - $router->attach('', '', static function (Map $router): void { |
|
94 | + $router->attach('', '', static function(Map $router): void { |
|
95 | 95 | |
96 | - $router->attach('', '/module-maj/admintasks', static function (Map $router): void { |
|
96 | + $router->attach('', '/module-maj/admintasks', static function(Map $router): void { |
|
97 | 97 | |
98 | - $router->attach('', '/admin', static function (Map $router): void { |
|
98 | + $router->attach('', '/admin', static function(Map $router): void { |
|
99 | 99 | |
100 | 100 | $router->extras([ |
101 | 101 | 'middleware' => [ |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | ]); |
105 | 105 | $router->get(AdminConfigPage::class, '/config', AdminConfigPage::class); |
106 | 106 | |
107 | - $router->attach('', '/tasks', static function (Map $router): void { |
|
107 | + $router->attach('', '/tasks', static function(Map $router): void { |
|
108 | 108 | |
109 | 109 | $router->get(TasksList::class, '', TasksList::class); |
110 | 110 | $router->get(TaskEditPage::class, '/{task}', TaskEditPage::class); |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function bodyContent(): string |
148 | 148 | { |
149 | - return view($this->name() . '::snippet', [ 'url' => route(TaskTrigger::class) ]); |
|
149 | + return view($this->name().'::snippet', ['url' => route(TaskTrigger::class)]); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | $task_schedules = $this->taskschedules_service->all(true, true) |
77 | - ->map(function (TaskSchedule $value): array { |
|
77 | + ->map(function(TaskSchedule $value): array { |
|
78 | 78 | |
79 | 79 | $row = $value->toArray(); |
80 | 80 | $task = $this->taskschedules_service->findTask($row['task_id']); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $sort_columns = ['task_name', 'enabled', 'last_run']; |
87 | 87 | $module_name = $this->module->name(); |
88 | 88 | |
89 | - $callback = function (array $row) use ($module_name): array { |
|
89 | + $callback = function(array $row) use ($module_name): array { |
|
90 | 90 | |
91 | 91 | $row['frequency']->setLocale(I18N::locale()->code()); |
92 | 92 | |
@@ -109,21 +109,20 @@ discard block |
||
109 | 109 | ]; |
110 | 110 | |
111 | 111 | $datum = [ |
112 | - view($module_name . '::admin/tasks-table-options', $task_options_params), |
|
113 | - view($module_name . '::components/yes-no-icons', ['yes' => $row['enabled']]), |
|
114 | - '<span dir="auto">' . e($row['task_name']) . '</span>', |
|
112 | + view($module_name.'::admin/tasks-table-options', $task_options_params), |
|
113 | + view($module_name.'::components/yes-no-icons', ['yes' => $row['enabled']]), |
|
114 | + '<span dir="auto">'.e($row['task_name']).'</span>', |
|
115 | 115 | $row['last_run']->unix() === 0 ? |
116 | - view('components/datetime', ['timestamp' => $row['last_run']]) : |
|
117 | - view('components/datetime-diff', ['timestamp' => $row['last_run']]), |
|
118 | - view($module_name . '::components/yes-no-icons', ['yes' => $row['last_result']]), |
|
119 | - '<span dir="auto">' . e($row['frequency']->cascade()->forHumans()) . '</span>', |
|
116 | + view('components/datetime', ['timestamp' => $row['last_run']]) : view('components/datetime-diff', ['timestamp' => $row['last_run']]), |
|
117 | + view($module_name.'::components/yes-no-icons', ['yes' => $row['last_result']]), |
|
118 | + '<span dir="auto">'.e($row['frequency']->cascade()->forHumans()).'</span>', |
|
120 | 119 | $row['nb_occurrences'] > 0 ? I18N::number($row['nb_occurrences']) : I18N::translate('Unlimited'), |
121 | - view($module_name . '::components/yes-no-icons', [ |
|
120 | + view($module_name.'::components/yes-no-icons', [ |
|
122 | 121 | 'yes' => $row['is_running'], |
123 | 122 | 'text_yes' => I18N::translate('Running'), |
124 | 123 | 'text_no' => I18N::translate('Not running') |
125 | 124 | ]), |
126 | - view($module_name . '::admin/tasks-table-run', $task_run_params) |
|
125 | + view($module_name.'::admin/tasks-table-run', $task_run_params) |
|
127 | 126 | ]; |
128 | 127 | |
129 | 128 | return $datum; |
@@ -34,7 +34,7 @@ |
||
34 | 34 | // Clean up previous admin tasks table if it exists |
35 | 35 | DB::schema()->dropIfExists('maj_admintasks'); |
36 | 36 | |
37 | - DB::schema()->create('maj_admintasks', static function (Blueprint $table): void { |
|
37 | + DB::schema()->create('maj_admintasks', static function(Blueprint $table): void { |
|
38 | 38 | |
39 | 39 | $table->increments('majat_id'); |
40 | 40 | $table->string('majat_task_id', 32)->unique(); |
@@ -195,14 +195,14 @@ discard block |
||
195 | 195 | $query = DB::table('maj_admintasks') |
196 | 196 | ->select() |
197 | 197 | ->where('majat_status', '=', 'enabled') |
198 | - ->where(function (Builder $query): void { |
|
198 | + ->where(function(Builder $query): void { |
|
199 | 199 | |
200 | 200 | $query->where('majat_running', '=', 0) |
201 | 201 | ->orWhere('majat_last_run', '<=', Carbon::now()->subSeconds(self::TASK_TIME_OUT)); |
202 | 202 | }); |
203 | 203 | |
204 | 204 | if (!$force) { |
205 | - $query->where(function (Builder $query): void { |
|
205 | + $query->where(function(Builder $query): void { |
|
206 | 206 | |
207 | 207 | $query->where('majat_running', '=', 0) |
208 | 208 | ->orWhereRaw('DATE_ADD(majat_last_run, INTERVAL majat_frequency MINUTE) <= NOW()'); |
@@ -268,17 +268,17 @@ discard block |
||
268 | 268 | */ |
269 | 269 | public static function rowMapper(): Closure |
270 | 270 | { |
271 | - return static function (stdClass $row): TaskSchedule { |
|
271 | + return static function(stdClass $row): TaskSchedule { |
|
272 | 272 | |
273 | 273 | return new TaskSchedule( |
274 | - (int) $row->majat_id, |
|
274 | + (int)$row->majat_id, |
|
275 | 275 | $row->majat_task_id, |
276 | 276 | $row->majat_status === 'enabled', |
277 | 277 | Carbon::parse($row->majat_last_run), |
278 | - (bool) $row->majat_last_result, |
|
278 | + (bool)$row->majat_last_result, |
|
279 | 279 | CarbonInterval::minutes($row->majat_frequency), |
280 | - (int) $row->majat_nb_occur, |
|
281 | - (bool) $row->majat_running |
|
280 | + (int)$row->majat_nb_occur, |
|
281 | + (bool)$row->majat_running |
|
282 | 282 | ); |
283 | 283 | }; |
284 | 284 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | public function changesByRecordType(Tree $tree, int $nb_days): Collection |
80 | 80 | { |
81 | 81 | return DB::table('change') |
82 | - ->joinSub($this->allGedcomRecords($tree), 'gedrecords', function (JoinClause $join) use ($tree): void { |
|
82 | + ->joinSub($this->allGedcomRecords($tree), 'gedrecords', function(JoinClause $join) use ($tree): void { |
|
83 | 83 | |
84 | 84 | $join->on('change.xref', '=', 'gedrecords.ged_id') |
85 | 85 | ->where('change.gedcom_id', '=', $tree->id()); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | new Expression('MAX(log_time) AS lastoccurred') |
116 | 116 | ) |
117 | 117 | ->where('log_type', '=', 'error') |
118 | - ->where(function (Builder $query) use ($tree): void { |
|
118 | + ->where(function(Builder $query) use ($tree): void { |
|
119 | 119 | $query->where('gedcom_id', '=', $tree->id()) |
120 | 120 | ->orWhereNull('gedcom_id'); |
121 | 121 | }) |
@@ -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, |