@@ -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 | }) |
@@ -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 | ); |
@@ -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); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
68 | 68 | } |
69 | 69 | |
70 | - $task_sched_id = (int) $request->getAttribute('task'); |
|
70 | + $task_sched_id = (int)$request->getAttribute('task'); |
|
71 | 71 | $task_schedule = $this->taskschedules_service->find($task_sched_id); |
72 | 72 | |
73 | 73 | if ($task_schedule === null) { |
@@ -83,9 +83,9 @@ discard block |
||
83 | 83 | $has_task_config = $task instanceof ConfigurableTaskInterface; |
84 | 84 | /** @var TaskInterface&ConfigurableTaskInterface $task */ |
85 | 85 | |
86 | - return $this->viewResponse($this->module->name() . '::admin/tasks-edit', [ |
|
86 | + return $this->viewResponse($this->module->name().'::admin/tasks-edit', [ |
|
87 | 87 | 'module' => $this->module, |
88 | - 'title' => I18N::translate('Edit the administrative task') . ' - ' . $task->name(), |
|
88 | + 'title' => I18N::translate('Edit the administrative task').' - '.$task->name(), |
|
89 | 89 | 'task_schedule' => $task_schedule, |
90 | 90 | 'task' => $task, |
91 | 91 | 'has_task_config' => $has_task_config, |
@@ -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 | /** |
@@ -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 | ]); |
@@ -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 | $max_gen = $params['sosa-maxgen'] ?? ''; |
63 | 63 |