Passed
Push — feature/code-analysis ( 00c5b4...e321b8 )
by Jonathan
13:27
created
app/Common/GeoDispersion/Config/GenericPlaceMapperConfig.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@
 block discarded – undo
100 100
     public function jsonDeserialize($config): self
101 101
     {
102 102
         if (is_string($config)) {
103
-            return $this->jsonDeserialize((array) json_decode($config));
103
+            return $this->jsonDeserialize((array)json_decode($config));
104 104
         }
105 105
         if (is_array($config)) {
106 106
             return $this->setConfig($config);
Please login to merge, or discard this patch.
app/Module/Sosa/Services/SosaStatisticsService.php 1 patch
Spacing   +58 added lines, -59 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      */
75 75
     public function maxGeneration(): int
76 76
     {
77
-        return (int) DB::table('maj_sosa')
77
+        return (int)DB::table('maj_sosa')
78 78
             ->where('majs_gedcom_id', '=', $this->tree->id())
79 79
             ->where('majs_user_id', '=', $this->user->id())
80 80
             ->max('majs_gen');
@@ -152,8 +152,7 @@  discard block
 block discarded – undo
152 152
             ->get()->first();
153 153
 
154 154
         $denom = $row->n * $row->sum_x2 - pow($row->sum_x, 2);
155
-        return ((int) $row->n === 0 || $denom === 0) ? 0 :
156
-            -($row->n * $row->sum_xy - $row->sum_x * $row->sum_y) / $denom;
155
+        return ((int)$row->n === 0 || $denom === 0) ? 0 : -($row->n * $row->sum_xy - $row->sum_x * $row->sum_y) / $denom;
157 156
     }
158 157
 
159 158
     /**
@@ -177,10 +176,10 @@  discard block
 block discarded – undo
177 176
 
178 177
         $statistics_by_gen = [];
179 178
         foreach ($stats_by_gen as $gen => $stats_gen) {
180
-            $statistics_by_gen[(int) $stats_gen->gen] = array(
181
-                'sosaCount'             =>  (int) $stats_gen->total_sosa,
182
-                'sosaTotalCount'        =>  (int) $cumul_stats_by_gen[$gen]->total_cumul,
183
-                'diffSosaTotalCount'    =>  (int) $cumul_stats_by_gen[$gen]->total_distinct_cumul,
179
+            $statistics_by_gen[(int)$stats_gen->gen] = array(
180
+                'sosaCount'             =>  (int)$stats_gen->total_sosa,
181
+                'sosaTotalCount'        =>  (int)$cumul_stats_by_gen[$gen]->total_cumul,
182
+                'diffSosaTotalCount'    =>  (int)$cumul_stats_by_gen[$gen]->total_distinct_cumul,
184 183
                 'firstBirth'            =>  $stats_gen->first_year,
185 184
                 'firstEstimatedBirth'   =>  $stats_gen->first_est_year,
186 185
                 'lastBirth'             =>  $stats_gen->last_year,
@@ -224,7 +223,7 @@  discard block
 block discarded – undo
224 223
             ->where('majs_user_id', '=', $this->user->id());
225 224
 
226 225
         return DB::table('maj_sosa')
227
-            ->joinSub($list_gen, 'list_gen', function (JoinClause $join): void {
226
+            ->joinSub($list_gen, 'list_gen', function(JoinClause $join): void {
228 227
                 $join->on('maj_sosa.majs_gen', '<=', 'list_gen.majs_gen')
229 228
                 ->where('majs_gedcom_id', '=', $this->tree->id())
230 229
                 ->where('majs_user_id', '=', $this->user->id());
@@ -265,37 +264,37 @@  discard block
 block discarded – undo
265 264
             ->select(['list_gen.majs_gen AS gen', 'sosa.majs_gedcom_id', 'sosa.majs_user_id'])
266 265
             ->addSelect(['sosa.majs_i_id', 'sosa.majs_gen'])
267 266
             ->selectRaw(
268
-                '(CASE ' .
269
-                    ' WHEN ' . $table_prefix . 'sosa_fat.majs_i_id IS NULL' .
270
-                    ' THEN POWER(2, ' . $table_prefix . 'list_gen.majs_gen - ' . $table_prefix . 'sosa.majs_gen - 1)' .
271
-                    ' ELSE 0 ' .
272
-                ' END)' .
273
-                ' + (CASE ' .
274
-                    ' WHEN ' . $table_prefix . 'sosa_mot.majs_i_id IS NULL' .
275
-                    ' THEN POWER(2, ' . $table_prefix . 'list_gen.majs_gen - ' . $table_prefix . 'sosa.majs_gen - 1)' .
276
-                    ' ELSE 0 ' .
267
+                '(CASE '.
268
+                    ' WHEN '.$table_prefix.'sosa_fat.majs_i_id IS NULL'.
269
+                    ' THEN POWER(2, '.$table_prefix.'list_gen.majs_gen - '.$table_prefix.'sosa.majs_gen - 1)'.
270
+                    ' ELSE 0 '.
271
+                ' END)'.
272
+                ' + (CASE '.
273
+                    ' WHEN '.$table_prefix.'sosa_mot.majs_i_id IS NULL'.
274
+                    ' THEN POWER(2, '.$table_prefix.'list_gen.majs_gen - '.$table_prefix.'sosa.majs_gen - 1)'.
275
+                    ' ELSE 0 '.
277 276
                 ' END) contrib'
278 277
             )
279
-            ->joinSub($list_gen, 'list_gen', function (JoinClause $join): void {
278
+            ->joinSub($list_gen, 'list_gen', function(JoinClause $join): void {
280 279
                 $join->on('sosa.majs_gen', '<', 'list_gen.majs_gen')
281 280
                     ->where('majs_gedcom_id', '=', $this->tree->id())
282 281
                     ->where('majs_user_id', '=', $this->user->id());
283 282
             })
284
-            ->leftJoin('maj_sosa AS sosa_fat', function (JoinClause $join) use ($table_prefix): void {
283
+            ->leftJoin('maj_sosa AS sosa_fat', function(JoinClause $join) use ($table_prefix): void {
285 284
                 // Link to sosa's father
286
-                $join->whereRaw($table_prefix . 'sosa_fat.majs_sosa = 2 * ' . $table_prefix . 'sosa.majs_sosa')
285
+                $join->whereRaw($table_prefix.'sosa_fat.majs_sosa = 2 * '.$table_prefix.'sosa.majs_sosa')
287 286
                     ->where('sosa_fat.majs_gedcom_id', '=', $this->tree->id())
288 287
                     ->where('sosa_fat.majs_user_id', '=', $this->user->id());
289 288
             })
290
-            ->leftJoin('maj_sosa AS sosa_mot', function (JoinClause $join) use ($table_prefix): void {
289
+            ->leftJoin('maj_sosa AS sosa_mot', function(JoinClause $join) use ($table_prefix): void {
291 290
                 // Link to sosa's mother
292
-                $join->whereRaw($table_prefix . 'sosa_mot.majs_sosa = 2 * ' . $table_prefix . 'sosa.majs_sosa + 1')
291
+                $join->whereRaw($table_prefix.'sosa_mot.majs_sosa = 2 * '.$table_prefix.'sosa.majs_sosa + 1')
293 292
                     ->where('sosa_mot.majs_gedcom_id', '=', $this->tree->id())
294 293
                     ->where('sosa_mot.majs_user_id', '=', $this->user->id());
295 294
             })
296 295
             ->where('sosa.majs_gedcom_id', '=', $this->tree->id())
297 296
             ->where('sosa.majs_user_id', '=', $this->user->id())
298
-            ->where(function (Builder $query): void {
297
+            ->where(function(Builder $query): void {
299 298
                 $query->whereNull('sosa_fat.majs_i_id')
300 299
                 ->orWhereNull('sosa_mot.majs_i_id');
301 300
             });
@@ -305,24 +304,24 @@  discard block
 block discarded – undo
305 304
          */
306 305
         $non_roots_ancestors = DB::table('maj_sosa AS sosa')
307 306
             ->select(['sosa.majs_gen', 'sosa.majs_gedcom_id', 'sosa.majs_user_id', 'sosa.majs_sosa'])
308
-            ->selectRaw('MAX(' . $table_prefix . 'sosa_anc.majs_sosa) - MIN(' . $table_prefix . 'sosa_anc.majs_sosa)' .
307
+            ->selectRaw('MAX('.$table_prefix.'sosa_anc.majs_sosa) - MIN('.$table_prefix.'sosa_anc.majs_sosa)'.
309 308
                 ' AS full_ancestors')
310
-            ->join('maj_sosa AS sosa_anc', function (JoinClause $join) use ($table_prefix): void {
309
+            ->join('maj_sosa AS sosa_anc', function(JoinClause $join) use ($table_prefix): void {
311 310
                 $join->on('sosa.majs_gen', '<', 'sosa_anc.majs_gen')
312
-                    ->whereRaw('FLOOR(' . $table_prefix . 'sosa_anc.majs_sosa / POWER(2, ' .
313
-                        $table_prefix . 'sosa_anc.majs_gen - ' . $table_prefix . 'sosa.majs_gen)) = ' .
314
-                        $table_prefix . 'sosa.majs_sosa')
311
+                    ->whereRaw('FLOOR('.$table_prefix.'sosa_anc.majs_sosa / POWER(2, '.
312
+                        $table_prefix.'sosa_anc.majs_gen - '.$table_prefix.'sosa.majs_gen)) = '.
313
+                        $table_prefix.'sosa.majs_sosa')
315 314
                     ->where('sosa_anc.majs_gedcom_id', '=', $this->tree->id())
316 315
                     ->where('sosa_anc.majs_user_id', '=', $this->user->id());
317 316
             })
318 317
             ->where('sosa.majs_gedcom_id', '=', $this->tree->id())
319 318
             ->where('sosa.majs_user_id', '=', $this->user->id())
320
-            ->whereIn('sosa_anc.majs_i_id', function (Builder $query) use ($table_prefix): void {
319
+            ->whereIn('sosa_anc.majs_i_id', function(Builder $query) use ($table_prefix): void {
321 320
                 $query->from('maj_sosa AS sosa_gen')
322 321
                 ->select('sosa_gen.majs_i_id')->distinct()
323 322
                 ->where('sosa_gen.majs_gedcom_id', '=', $this->tree->id())
324 323
                 ->where('sosa_gen.majs_user_id', '=', $this->user->id())
325
-                ->whereRaw($table_prefix . 'sosa_gen.majs_gen = ' . $table_prefix . 'sosa.majs_gen');
324
+                ->whereRaw($table_prefix.'sosa_gen.majs_gen = '.$table_prefix.'sosa.majs_gen');
326 325
             })
327 326
             ->groupBy(['sosa.majs_gen', 'sosa.majs_gedcom_id', 'sosa.majs_user_id',
328 327
                 'sosa.majs_sosa', 'sosa.majs_i_id']);
@@ -335,7 +334,7 @@  discard block
 block discarded – undo
335 334
             ->select(['sosa.majs_gen AS gen', 'sosa.majs_gedcom_id', 'sosa.majs_user_id'])
336 335
             ->addSelect(['sosa.majs_i_id', 'sosa.majs_gen'])
337 336
             ->selectRaw('1 AS contrib')
338
-            ->leftJoinSub($non_roots_ancestors, 'nonroot', function (JoinClause $join): void {
337
+            ->leftJoinSub($non_roots_ancestors, 'nonroot', function(JoinClause $join): void {
339 338
                 $join->on('sosa.majs_gen', '=', 'nonroot.majs_gen')
340 339
                     ->on('sosa.majs_sosa', '=', 'nonroot.majs_sosa')
341 340
                     ->where('nonroot.full_ancestors', '>', 0)
@@ -353,9 +352,9 @@  discard block
 block discarded – undo
353 352
             ->fromSub($root_ancestors_contributions->unionAll($known_ancestors_contributions), 'sosa_contribs')
354 353
             ->select(['sosa_contribs.gen', 'sosa_contribs.majs_gedcom_id', 'sosa_contribs.majs_user_id'])
355 354
             ->addSelect(['sosa_contribs.majs_i_id', 'sosa_contribs.contrib'])
356
-            ->selectRaw('COUNT(' . $table_prefix . 'sosa_contribs.majs_i_id) * ' .
357
-                $table_prefix . 'sosa_contribs.contrib AS totalContrib')
358
-            ->leftJoin('maj_sosa AS sosa_low', function (JoinClause $join): void {
355
+            ->selectRaw('COUNT('.$table_prefix.'sosa_contribs.majs_i_id) * '.
356
+                $table_prefix.'sosa_contribs.contrib AS totalContrib')
357
+            ->leftJoin('maj_sosa AS sosa_low', function(JoinClause $join): void {
359 358
                 $join->on('sosa_low.majs_gen', '<', 'sosa_contribs.majs_gen')
360 359
                     ->on('sosa_low.majs_i_id', '=', 'sosa_contribs.majs_i_id')
361 360
                     ->where('sosa_low.majs_gedcom_id', '=', $this->tree->id())
@@ -376,9 +375,9 @@  discard block
 block discarded – undo
376 375
 
377 376
         $pedi_collapse_by_gen = [];
378 377
         foreach ($pedi_collapse_coll as $collapse_gen) {
379
-            $pedi_collapse_by_gen[(int) $collapse_gen->gen] = array(
380
-                'pedi_collapse_roots'   =>  (float) $collapse_gen->pedi_collapse_roots,
381
-                'pedi_collapse_xgen'   =>  (float) $collapse_gen->pedi_collapse_xgen
378
+            $pedi_collapse_by_gen[(int)$collapse_gen->gen] = array(
379
+                'pedi_collapse_roots'   =>  (float)$collapse_gen->pedi_collapse_roots,
380
+                'pedi_collapse_xgen'   =>  (float)$collapse_gen->pedi_collapse_xgen
382 381
             );
383 382
         }
384 383
         return $pedi_collapse_by_gen;
@@ -410,26 +409,26 @@  discard block
 block discarded – undo
410 409
 
411 410
         $table_prefix = DB::connection()->getTablePrefix();
412 411
         $missing_ancestors_by_gen = DB::table('maj_sosa AS sosa')
413
-            ->selectRaw($table_prefix . 'sosa.majs_gen - ? AS majs_gen_norm', [$gen])
414
-            ->selectRaw('FLOOR(((' . $table_prefix . 'sosa.majs_sosa / POW(2, ' . $table_prefix . 'sosa.majs_gen -1 )) - 1) * POWER(2, ? - 1)) + POWER(2, ? - 1) AS root_ancestor', [$gen, $gen])   //@phpcs:ignore Generic.Files.LineLength.TooLong
415
-            ->selectRaw('SUM(CASE WHEN ' . $table_prefix . 'sosa_fat.majs_i_id IS NULL AND ' . $table_prefix . 'sosa_mot.majs_i_id IS NULL THEN 1 ELSE 0 END) AS full_root_count')  //@phpcs:ignore Generic.Files.LineLength.TooLong
416
-            ->selectRaw('SUM(CASE WHEN ' . $table_prefix . 'sosa_fat.majs_i_id IS NULL AND ' . $table_prefix . 'sosa_mot.majs_i_id IS NULL THEN 0 ELSE 1 END) As semi_root_count')  //@phpcs:ignore Generic.Files.LineLength.TooLong
417
-            ->leftJoin('maj_sosa AS sosa_fat', function (JoinClause $join) use ($table_prefix): void {
412
+            ->selectRaw($table_prefix.'sosa.majs_gen - ? AS majs_gen_norm', [$gen])
413
+            ->selectRaw('FLOOR((('.$table_prefix.'sosa.majs_sosa / POW(2, '.$table_prefix.'sosa.majs_gen -1 )) - 1) * POWER(2, ? - 1)) + POWER(2, ? - 1) AS root_ancestor', [$gen, $gen])   //@phpcs:ignore Generic.Files.LineLength.TooLong
414
+            ->selectRaw('SUM(CASE WHEN '.$table_prefix.'sosa_fat.majs_i_id IS NULL AND '.$table_prefix.'sosa_mot.majs_i_id IS NULL THEN 1 ELSE 0 END) AS full_root_count')  //@phpcs:ignore Generic.Files.LineLength.TooLong
415
+            ->selectRaw('SUM(CASE WHEN '.$table_prefix.'sosa_fat.majs_i_id IS NULL AND '.$table_prefix.'sosa_mot.majs_i_id IS NULL THEN 0 ELSE 1 END) As semi_root_count')  //@phpcs:ignore Generic.Files.LineLength.TooLong
416
+            ->leftJoin('maj_sosa AS sosa_fat', function(JoinClause $join) use ($table_prefix): void {
418 417
                 // Link to sosa's father
419
-                $join->whereRaw($table_prefix . 'sosa_fat.majs_sosa = 2 * ' . $table_prefix . 'sosa.majs_sosa')
418
+                $join->whereRaw($table_prefix.'sosa_fat.majs_sosa = 2 * '.$table_prefix.'sosa.majs_sosa')
420 419
                 ->where('sosa_fat.majs_gedcom_id', '=', $this->tree->id())
421 420
                 ->where('sosa_fat.majs_user_id', '=', $this->user->id());
422 421
             })
423
-            ->leftJoin('maj_sosa AS sosa_mot', function (JoinClause $join) use ($table_prefix): void {
422
+            ->leftJoin('maj_sosa AS sosa_mot', function(JoinClause $join) use ($table_prefix): void {
424 423
                 // Link to sosa's mother
425
-                $join->whereRaw($table_prefix . 'sosa_mot.majs_sosa = 2 * ' . $table_prefix . 'sosa.majs_sosa + 1')
424
+                $join->whereRaw($table_prefix.'sosa_mot.majs_sosa = 2 * '.$table_prefix.'sosa.majs_sosa + 1')
426 425
                 ->where('sosa_mot.majs_gedcom_id', '=', $this->tree->id())
427 426
                 ->where('sosa_mot.majs_user_id', '=', $this->user->id());
428 427
             })
429 428
             ->where('sosa.majs_gedcom_id', '=', $this->tree->id())
430 429
             ->where('sosa.majs_user_id', '=', $this->user->id())
431 430
             ->where('sosa.majs_gen', '>=', $gen)
432
-            ->where(function (Builder $query): void {
431
+            ->where(function(Builder $query): void {
433 432
                 $query->whereNull('sosa_fat.majs_i_id')
434 433
                     ->orWhereNull('sosa_mot.majs_i_id');
435 434
             })
@@ -438,11 +437,11 @@  discard block
 block discarded – undo
438 437
         return DB::table('maj_sosa AS sosa_list')
439 438
             ->select(['stats_by_gen.root_ancestor AS root_ancestor_sosa', 'sosa_list.majs_i_id as root_ancestor_id'])
440 439
             ->selectRaw('1 + SUM( (majs_gen_norm) * ( 2 * full_root_count + semi_root_count) /  (2 * POWER(2, majs_gen_norm))) AS mean_gen_depth')  //@phpcs:ignore Generic.Files.LineLength.TooLong
441
-            ->selectRaw(' SQRT(' .
442
-                '   SUM(POWER(majs_gen_norm, 2) * ( 2 * full_root_count + semi_root_count) /  (2 * POWER(2, majs_gen_norm)))' .     //@phpcs:ignore Generic.Files.LineLength.TooLong
443
-                '   - POWER( SUM( (majs_gen_norm) * ( 2 * full_root_count + semi_root_count) /  (2 * POWER(2, majs_gen_norm))), 2)' .       //@phpcs:ignore Generic.Files.LineLength.TooLong
440
+            ->selectRaw(' SQRT('.
441
+                '   SUM(POWER(majs_gen_norm, 2) * ( 2 * full_root_count + semi_root_count) /  (2 * POWER(2, majs_gen_norm)))'.//@phpcs:ignore Generic.Files.LineLength.TooLong
442
+                '   - POWER( SUM( (majs_gen_norm) * ( 2 * full_root_count + semi_root_count) /  (2 * POWER(2, majs_gen_norm))), 2)'.//@phpcs:ignore Generic.Files.LineLength.TooLong
444 443
                 ' ) AS stddev_gen_depth')
445
-            ->joinSub($missing_ancestors_by_gen, 'stats_by_gen', function (JoinClause $join): void {
444
+            ->joinSub($missing_ancestors_by_gen, 'stats_by_gen', function(JoinClause $join): void {
446 445
                 $join->on('sosa_list.majs_sosa', '=', 'stats_by_gen.root_ancestor')
447 446
                     ->where('sosa_list.majs_gedcom_id', '=', $this->tree->id())
448 447
                     ->where('sosa_list.majs_user_id', '=', $this->user->id());
@@ -471,16 +470,16 @@  discard block
 block discarded – undo
471 470
         $table_prefix = DB::connection()->getTablePrefix();
472 471
         $multiple_ancestors = DB::table('maj_sosa AS sosa')
473 472
             ->select('sosa.majs_i_id AS sosa_i_id')
474
-            ->selectRaw('COUNT(' . $table_prefix . 'sosa.majs_sosa) AS sosa_count')
475
-            ->leftJoin('maj_sosa AS sosa_fat', function (JoinClause $join) use ($table_prefix): void {
473
+            ->selectRaw('COUNT('.$table_prefix.'sosa.majs_sosa) AS sosa_count')
474
+            ->leftJoin('maj_sosa AS sosa_fat', function(JoinClause $join) use ($table_prefix): void {
476 475
                 // Link to sosa's father
477
-                $join->whereRaw($table_prefix . 'sosa_fat.majs_sosa = 2 * ' . $table_prefix . 'sosa.majs_sosa')
476
+                $join->whereRaw($table_prefix.'sosa_fat.majs_sosa = 2 * '.$table_prefix.'sosa.majs_sosa')
478 477
                     ->where('sosa_fat.majs_gedcom_id', '=', $this->tree->id())
479 478
                     ->where('sosa_fat.majs_user_id', '=', $this->user->id());
480 479
             })
481
-            ->leftJoin('maj_sosa AS sosa_mot', function (JoinClause $join) use ($table_prefix): void {
480
+            ->leftJoin('maj_sosa AS sosa_mot', function(JoinClause $join) use ($table_prefix): void {
482 481
                 // Link to sosa's mother
483
-                $join->whereRaw($table_prefix . 'sosa_mot.majs_sosa = 2 * ' . $table_prefix . 'sosa.majs_sosa + 1')
482
+                $join->whereRaw($table_prefix.'sosa_mot.majs_sosa = 2 * '.$table_prefix.'sosa.majs_sosa + 1')
484 483
                 ->where('sosa_mot.majs_gedcom_id', '=', $this->tree->id())
485 484
                 ->where('sosa_mot.majs_user_id', '=', $this->user->id());
486 485
             })
@@ -489,15 +488,15 @@  discard block
 block discarded – undo
489 488
             ->whereNull('sosa_fat.majs_sosa')   // We keep only root individuals, i.e. those with no father or mother
490 489
             ->whereNull('sosa_mot.majs_sosa')
491 490
             ->groupBy('sosa.majs_i_id')
492
-            ->havingRaw('COUNT(' . $table_prefix . 'sosa.majs_sosa) > 1')    // Limit to the duplicate sosas.
493
-            ->orderByRaw('COUNT(' . $table_prefix . 'sosa.majs_sosa) DESC, MIN(' . $table_prefix . 'sosa.majs_sosa) ASC')   //@phpcs:ignore Generic.Files.LineLength.TooLong
491
+            ->havingRaw('COUNT('.$table_prefix.'sosa.majs_sosa) > 1')    // Limit to the duplicate sosas.
492
+            ->orderByRaw('COUNT('.$table_prefix.'sosa.majs_sosa) DESC, MIN('.$table_prefix.'sosa.majs_sosa) ASC')   //@phpcs:ignore Generic.Files.LineLength.TooLong
494 493
             ->limit($limit + 1)     // We want to select one more than required, for ties
495 494
             ->get();
496 495
 
497 496
         if ($multiple_ancestors->count() > $limit) {
498 497
             $last_count = $multiple_ancestors->last()->sosa_count;
499 498
             $multiple_ancestors = $multiple_ancestors->reject(
500
-                fn (stdClass $element): bool => $element->sosa_count ===  $last_count
499
+                fn (stdClass $element): bool => $element->sosa_count === $last_count
501 500
             );
502 501
         }
503 502
         return $multiple_ancestors;
@@ -552,7 +551,7 @@  discard block
 block discarded – undo
552 551
             ->rightJoinSub(
553 552
                 $consolidated_ancestors_branches,
554 553
                 'indi_branch_consolidated',
555
-                function (JoinClause $join) use ($gen): void {
554
+                function(JoinClause $join) use ($gen): void {
556 555
                     $join->where('maj_sosa.majs_gedcom_id', '=', $this->tree->id())
557 556
                         ->where('maj_sosa.majs_user_id', '=', $this->user->id())
558 557
                         ->where('branches', '>', 0)
Please login to merge, or discard this patch.
app/Module/MiscExtensions/MiscExtensionsModule.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
     public function boot(): void
70 70
     {
71 71
         $this->traitBoot();
72
-        View::registerCustomView('::modules/privacy-policy/page', $this->name() . '::privacy-policy');
72
+        View::registerCustomView('::modules/privacy-policy/page', $this->name().'::privacy-policy');
73 73
 
74
-        if ((int) $this->getPreference('MAJ_USE_LEGACY_XREF') === 1) {
74
+        if ((int)$this->getPreference('MAJ_USE_LEGACY_XREF') === 1) {
75 75
             Registry::xrefFactory(new LegacyXrefFactory());
76 76
         }
77 77
     }
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function loadRoutes(Map $router): void
84 84
     {
85
-        $router->attach('', '', static function (Map $router): void {
85
+        $router->attach('', '', static function(Map $router): void {
86 86
 
87
-            $router->attach('', '/module-maj/misc', static function (Map $router): void {
87
+            $router->attach('', '/module-maj/misc', static function(Map $router): void {
88 88
 
89
-                $router->attach('', '/config/admin', static function (Map $router): void {
89
+                $router->attach('', '/config/admin', static function(Map $router): void {
90 90
 
91 91
                     $router->get(AdminConfigPage::class, '', AdminConfigPage::class);
92 92
                     $router->post(AdminConfigAction::class, '', AdminConfigAction::class);
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
     public function listSubscribedHooks(): array
121 121
     {
122 122
         return [
123
-            app()->makeWith(TitlesCardHook::class, [ 'module' => $this ])
123
+            app()->makeWith(TitlesCardHook::class, ['module' => $this])
124 124
         ];
125 125
     }
126 126
 }
Please login to merge, or discard this patch.
app/Module/MiscExtensions/Http/RequestHandlers/AdminConfigAction.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         );
62 62
         $this->module->setPreference(
63 63
             'MAJ_DISPLAY_CNIL',
64
-            (string) Validator::parsedBody($request)->integer('MAJ_DISPLAY_CNIL', 0)
64
+            (string)Validator::parsedBody($request)->integer('MAJ_DISPLAY_CNIL', 0)
65 65
         );
66 66
         $this->module->setPreference(
67 67
             'MAJ_CNIL_REFERENCE',
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         );
70 70
         $this->module->setPreference(
71 71
             'MAJ_USE_LEGACY_XREF',
72
-            (string) Validator::parsedBody($request)->integer('MAJ_USE_LEGACY_XREF', 0)
72
+            (string)Validator::parsedBody($request)->integer('MAJ_USE_LEGACY_XREF', 0)
73 73
         );
74 74
 
75 75
         FlashMessages::addMessage(
Please login to merge, or discard this patch.
app/Module/IsSourced/Hooks/IsSourcedStatusHook.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
     public function recordNameAppend(GedcomRecord $record, bool $use_long = false, string $size = ''): string
66 66
     {
67 67
         if ($use_long && $record instanceof Individual) {
68
-            return view($this->module()->name() . '::hooks/name-append', [
68
+            return view($this->module()->name().'::hooks/name-append', [
69 69
                 'module_name'           =>  $this->module()->name(),
70 70
                 'source_status_service' =>  $this->source_status_service,
71 71
                 'individual'            =>  $record,
Please login to merge, or discard this patch.
app/Module/IsSourced/Services/SourceStatusService.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
      */
48 48
     private function extractCitations(Fact $fact)
49 49
     {
50
-        $extract_regex = '/\n(2 SOUR @(' . Gedcom::REGEX_XREF . ')@(?:\n[3-9] .*)*)/';
50
+        $extract_regex = '/\n(2 SOUR @('.Gedcom::REGEX_XREF.')@(?:\n[3-9] .*)*)/';
51 51
         preg_match_all($extract_regex, $fact->gedcom(), $matches, PREG_SET_ORDER);
52 52
         $citations = [];
53 53
         foreach ($matches as $match) {
Please login to merge, or discard this patch.
app/Module/GeoDispersion/Model/GeoAnalysisMapAdapter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
                     ->withProperty(
157 157
                         'places',
158 158
                         $feature_data->places()
159
-                            ->map(fn(GeoAnalysisPlace $place): string => $place->place()->firstParts(1)->first())
159
+                            ->map(fn(GeoAnalysisPlace $place) : string => $place->place()->firstParts(1)->first())
160 160
                             ->sort(I18N::comparator())
161 161
                             ->toArray()
162 162
                     );
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
             ->each(
171 171
                 fn (MapFeatureAnalysisData $data) =>
172 172
                     $data->places()->each(
173
-                        function (GeoAnalysisPlace $place) use ($result): void {
173
+                        function(GeoAnalysisPlace $place) use ($result): void {
174 174
                             $result->exclude($place);
175 175
                         }
176 176
                     )
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
         $features_mapping = new Collection();
191 191
 
192 192
         $byplaces = $result->knownPlaces();
193
-        $byplaces->each(function (GeoAnalysisResultItem $item) use ($features_mapping, $result): void {
193
+        $byplaces->each(function(GeoAnalysisResultItem $item) use ($features_mapping, $result): void {
194 194
             $id = $this->place_mapper->map($item->place()->place(), $this->config->mapMappingProperty());
195 195
 
196 196
             if ($id !== null && mb_strlen($id) > 0) {
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
             }
204 204
         });
205 205
 
206
-        return [ $features_mapping, $result];
206
+        return [$features_mapping, $result];
207 207
     }
208 208
 
209 209
     /**
Please login to merge, or discard this patch.
app/Module/Certificates/CertificatesModule.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -113,11 +113,11 @@  discard block
 block discarded – undo
113 113
      */
114 114
     public function loadRoutes(Map $router): void
115 115
     {
116
-        $router->attach('', '', static function (Map $router): void {
116
+        $router->attach('', '', static function(Map $router): void {
117 117
 
118
-            $router->attach('', '/module-maj/certificates', static function (Map $router): void {
118
+            $router->attach('', '/module-maj/certificates', static function(Map $router): void {
119 119
 
120
-                $router->attach('', '/admin', static function (Map $router): void {
120
+                $router->attach('', '/admin', static function(Map $router): void {
121 121
 
122 122
                     $router->get(AdminConfigPage::class, '/config{/tree}', AdminConfigPage::class);
123 123
                     $router->post(AdminConfigAction::class, '/config/{tree}', AdminConfigAction::class)
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
                         'permission_preference' =>  'MAJ_CERTIF_SHOW_CERT'
141 141
                     ]);
142 142
 
143
-                $router->attach('', '/certificate/{tree}/{cid}', static function (Map $router): void {
143
+                $router->attach('', '/certificate/{tree}/{cid}', static function(Map $router): void {
144 144
 
145 145
                     $router->extras([
146 146
                         'middleware'            =>  [AuthTreePreference::class],
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
      */
179 179
     public function headContent(): string
180 180
     {
181
-        return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">';
181
+        return '<link rel="stylesheet" href="'.e($this->moduleCssUrl()).'">';
182 182
     }
183 183
 
184 184
     /**
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
      */
190 190
     public function listUrl(Tree $tree, array $parameters = []): string
191 191
     {
192
-        return route(CertificatesList::class, ['tree' => $tree->name() ] + $parameters);
192
+        return route(CertificatesList::class, ['tree' => $tree->name()] + $parameters);
193 193
     }
194 194
 
195 195
     /**
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
      */
208 208
     public function listIsEmpty(Tree $tree): bool
209 209
     {
210
-        return Auth::accessLevel($tree) > (int) $tree->getPreference('MAJ_CERTIF_SHOW_CERT', (string) Auth::PRIV_HIDE);
210
+        return Auth::accessLevel($tree) > (int)$tree->getPreference('MAJ_CERTIF_SHOW_CERT', (string)Auth::PRIV_HIDE);
211 211
     }
212 212
 
213 213
     /**
Please login to merge, or discard this patch.
app/Module/MiscExtensions/Factories/LegacyXrefFactory.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
             return parent::generate($prefix, $suffix);
55 55
         }
56 56
 
57
-        $setting_name = 'MAJ_MISC_XREF_NEXT_' . $prefix;
57
+        $setting_name = 'MAJ_MISC_XREF_NEXT_'.$prefix;
58 58
         // Lock the row, so that only one new XREF may be generated at a time.
59
-        $num = (int) DB::table('gedcom_setting')
59
+        $num = (int)DB::table('gedcom_setting')
60 60
             ->where('gedcom_id', '=', $tree->id())
61 61
             ->where('setting_name', '=', $setting_name)
62 62
             ->lockForUpdate()
@@ -64,13 +64,13 @@  discard block
 block discarded – undo
64 64
 
65 65
         $increment = 1.0;
66 66
         do {
67
-            $num += (int) $increment;
67
+            $num += (int)$increment;
68 68
 
69 69
             // This exponential increment allows us to scan over large blocks of
70 70
             // existing data in a reasonable time.
71 71
             $increment *= 1.01;
72 72
 
73
-            $xref = $prefix . $num . $suffix;
73
+            $xref = $prefix.$num.$suffix;
74 74
 
75 75
             // Records may already exist with this sequence number.
76 76
             $already_used =
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
                 DB::table('change')->where('gedcom_id', '=', $tree->id())->where('xref', '=', $xref)->exists();
83 83
         } while ($already_used);
84 84
 
85
-        $tree->setPreference($setting_name, (string) $num);
85
+        $tree->setPreference($setting_name, (string)$num);
86 86
 
87 87
         return $xref;
88 88
     }
Please login to merge, or discard this patch.