Passed
Branch feature/2.1-geodispersion-dev (1d61a8)
by Jonathan
61:21
created
Module/GeoDispersion/PlaceMappers/Config/FilteredTopPlaceMapperConfig.php 2 patches
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -24,60 +24,60 @@
 block discarded – undo
24 24
  */
25 25
 class FilteredTopPlaceMapperConfig extends GenericPlaceMapperConfig
26 26
 {
27
-    private TreeService $tree_service;
27
+	private TreeService $tree_service;
28 28
 
29
-    /**
30
-     * FilteredTopPlaceMapperConfig
31
-     *
32
-     * @param TreeService $tree_service
33
-     */
34
-    public function __construct(TreeService $tree_service)
35
-    {
36
-        $this->tree_service = $tree_service;
37
-    }
29
+	/**
30
+	 * FilteredTopPlaceMapperConfig
31
+	 *
32
+	 * @param TreeService $tree_service
33
+	 */
34
+	public function __construct(TreeService $tree_service)
35
+	{
36
+		$this->tree_service = $tree_service;
37
+	}
38 38
 
39
-    /**
40
-     * {@inheritDoc}
41
-     * @see \MyArtJaub\Webtrees\Common\GeoDispersion\Config\GenericPlaceMapperConfig::jsonSerializeConfig()
42
-     */
43
-    public function jsonSerializeConfig()
44
-    {
45
-        return [
46
-            'topPlaces' => collect($this->get('topPlaces', []))
47
-                ->filter(
48
-                    /** @psalm-suppress MissingClosureParamType */
49
-                    fn($item): bool => $item instanceof Place
50
-                )->map(fn(Place $place): array => [ $place->tree()->id(), $place->gedcomName() ])
51
-                ->toArray()
52
-        ];
53
-    }
39
+	/**
40
+	 * {@inheritDoc}
41
+	 * @see \MyArtJaub\Webtrees\Common\GeoDispersion\Config\GenericPlaceMapperConfig::jsonSerializeConfig()
42
+	 */
43
+	public function jsonSerializeConfig()
44
+	{
45
+		return [
46
+			'topPlaces' => collect($this->get('topPlaces', []))
47
+				->filter(
48
+					/** @psalm-suppress MissingClosureParamType */
49
+					fn($item): bool => $item instanceof Place
50
+				)->map(fn(Place $place): array => [ $place->tree()->id(), $place->gedcomName() ])
51
+				->toArray()
52
+		];
53
+	}
54 54
 
55
-    /**
56
-     * {@inheritDoc}
57
-     * @see \MyArtJaub\Webtrees\Common\GeoDispersion\Config\GenericPlaceMapperConfig::jsonDeserialize()
58
-     */
59
-    public function jsonDeserialize($config): self
60
-    {
61
-        if (is_string($config)) {
62
-            return $this->jsonDeserialize(json_decode($config));
63
-        }
64
-        if (is_array($config)) {
65
-            $this->setConfig([
66
-                'topPlaces' => collect($config['topPlaces'] ?? [])
67
-                    ->filter(
68
-                        /** @psalm-suppress MissingClosureParamType */
69
-                        fn($item): bool => is_array($item) && count($item) == 2
70
-                    )->map(function (array $item): ?Place {
71
-                        try {
72
-                            return new Place($item[1], $this->tree_service->find($item[0]));
73
-                        } catch (RuntimeException $ex) {
74
-                            return null;
75
-                        }
76
-                    })
77
-                    ->filter()
78
-                    ->toArray()
79
-                ]);
80
-        }
81
-        return $this;
82
-    }
55
+	/**
56
+	 * {@inheritDoc}
57
+	 * @see \MyArtJaub\Webtrees\Common\GeoDispersion\Config\GenericPlaceMapperConfig::jsonDeserialize()
58
+	 */
59
+	public function jsonDeserialize($config): self
60
+	{
61
+		if (is_string($config)) {
62
+			return $this->jsonDeserialize(json_decode($config));
63
+		}
64
+		if (is_array($config)) {
65
+			$this->setConfig([
66
+				'topPlaces' => collect($config['topPlaces'] ?? [])
67
+					->filter(
68
+						/** @psalm-suppress MissingClosureParamType */
69
+						fn($item): bool => is_array($item) && count($item) == 2
70
+					)->map(function (array $item): ?Place {
71
+						try {
72
+							return new Place($item[1], $this->tree_service->find($item[0]));
73
+						} catch (RuntimeException $ex) {
74
+							return null;
75
+						}
76
+					})
77
+					->filter()
78
+					->toArray()
79
+				]);
80
+		}
81
+		return $this;
82
+	}
83 83
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
                 ->filter(
48 48
                     /** @psalm-suppress MissingClosureParamType */
49 49
                     fn($item): bool => $item instanceof Place
50
-                )->map(fn(Place $place): array => [ $place->tree()->id(), $place->gedcomName() ])
50
+                )->map(fn(Place $place): array => [$place->tree()->id(), $place->gedcomName()])
51 51
                 ->toArray()
52 52
         ];
53 53
     }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
                     ->filter(
68 68
                         /** @psalm-suppress MissingClosureParamType */
69 69
                         fn($item): bool => is_array($item) && count($item) == 2
70
-                    )->map(function (array $item): ?Place {
70
+                    )->map(function(array $item): ?Place {
71 71
                         try {
72 72
                             return new Place($item[1], $this->tree_service->find($item[0]));
73 73
                         } catch (RuntimeException $ex) {
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/PlaceMappers/PlaceMapperTrait.php 1 patch
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -24,65 +24,65 @@
 block discarded – undo
24 24
  */
25 25
 trait PlaceMapperTrait
26 26
 {
27
-    private ?PlaceMapperConfigInterface $config = null;
28
-    private array $data = [];
27
+	private ?PlaceMapperConfigInterface $config = null;
28
+	private array $data = [];
29 29
 
30
-    /**
31
-     * Implementation of PlaceMapperInterface::boot
32
-     *
33
-     * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::boot()
34
-     */
35
-    public function boot(): void
36
-    {
37
-    }
30
+	/**
31
+	 * Implementation of PlaceMapperInterface::boot
32
+	 *
33
+	 * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::boot()
34
+	 */
35
+	public function boot(): void
36
+	{
37
+	}
38 38
 
39
-    /**
40
-     * Implementation of PlaceMapperInterface::config
41
-     *
42
-     * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::config()
43
-     *
44
-     * @return PlaceMapperConfigInterface
45
-     */
46
-    public function config(): PlaceMapperConfigInterface
47
-    {
48
-        return $this->config ?? new NullPlaceMapperConfig();
49
-    }
39
+	/**
40
+	 * Implementation of PlaceMapperInterface::config
41
+	 *
42
+	 * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::config()
43
+	 *
44
+	 * @return PlaceMapperConfigInterface
45
+	 */
46
+	public function config(): PlaceMapperConfigInterface
47
+	{
48
+		return $this->config ?? new NullPlaceMapperConfig();
49
+	}
50 50
 
51
-    /**
52
-     * Implementation of PlaceMapperInterface::setConfig
53
-     *
54
-     * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::setConfig()
55
-     *
56
-     * @param PlaceMapperConfigInterface $config
57
-     */
58
-    public function setConfig(PlaceMapperConfigInterface $config): void
59
-    {
60
-        $this->config = $config;
61
-    }
51
+	/**
52
+	 * Implementation of PlaceMapperInterface::setConfig
53
+	 *
54
+	 * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::setConfig()
55
+	 *
56
+	 * @param PlaceMapperConfigInterface $config
57
+	 */
58
+	public function setConfig(PlaceMapperConfigInterface $config): void
59
+	{
60
+		$this->config = $config;
61
+	}
62 62
 
63
-    /**
64
-     * Implementation of PlaceMapperInterface::data
65
-     *
66
-     * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::data()
67
-     *
68
-     * @param string $key
69
-     * @return NULL|mixed
70
-     */
71
-    public function data(string $key)
72
-    {
73
-        return $this->data[$key] ?? null;
74
-    }
63
+	/**
64
+	 * Implementation of PlaceMapperInterface::data
65
+	 *
66
+	 * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::data()
67
+	 *
68
+	 * @param string $key
69
+	 * @return NULL|mixed
70
+	 */
71
+	public function data(string $key)
72
+	{
73
+		return $this->data[$key] ?? null;
74
+	}
75 75
 
76
-    /**
77
-     * Implementation of PlaceMapperInterface::setData
78
-     *
79
-     * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::setData()
80
-     *
81
-     * @param string $key
82
-     * @param mixed|null $data
83
-     */
84
-    public function setData(string $key, $data): void
85
-    {
86
-        $this->data[$key] = $data;
87
-    }
76
+	/**
77
+	 * Implementation of PlaceMapperInterface::setData
78
+	 *
79
+	 * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::setData()
80
+	 *
81
+	 * @param string $key
82
+	 * @param mixed|null $data
83
+	 */
84
+	public function setData(string $key, $data): void
85
+	{
86
+		$this->data[$key] = $data;
87
+	}
88 88
 }
Please login to merge, or discard this patch.
Webtrees/Module/GeoDispersion/GeoAnalyses/AllEventsByTypeGeoAnalysis.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -26,55 +26,55 @@
 block discarded – undo
26 26
  */
27 27
 class AllEventsByTypeGeoAnalysis implements GeoAnalysisInterface
28 28
 {
29
-    private GeoAnalysisDataService $geoanalysis_data_service;
29
+	private GeoAnalysisDataService $geoanalysis_data_service;
30 30
 
31
-    /**
32
-     * Constructor for AllEventsByTypeGeoAnalysis
33
-     *
34
-     * @param GeoAnalysisDataService $geoanalysis_data_service
35
-     */
36
-    public function __construct(GeoAnalysisDataService $geoanalysis_data_service)
37
-    {
38
-        $this->geoanalysis_data_service = $geoanalysis_data_service;
39
-    }
31
+	/**
32
+	 * Constructor for AllEventsByTypeGeoAnalysis
33
+	 *
34
+	 * @param GeoAnalysisDataService $geoanalysis_data_service
35
+	 */
36
+	public function __construct(GeoAnalysisDataService $geoanalysis_data_service)
37
+	{
38
+		$this->geoanalysis_data_service = $geoanalysis_data_service;
39
+	}
40 40
 
41
-    /**
42
-     * {@inheritDoc}
43
-     * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\GeoAnalysisInterface::title()
44
-     */
45
-    public function title(): string
46
-    {
47
-        return I18N::translate('All events places');
48
-    }
41
+	/**
42
+	 * {@inheritDoc}
43
+	 * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\GeoAnalysisInterface::title()
44
+	 */
45
+	public function title(): string
46
+	{
47
+		return I18N::translate('All events places');
48
+	}
49 49
 
50
-    /**
51
-     * {@inheritDoc}
52
-     * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\GeoAnalysisInterface::itemsDescription()
53
-     */
54
-    public function itemsDescription(): callable
55
-    {
56
-        return fn(int $count): string => I18N::plural('event', 'events', $count);
57
-    }
50
+	/**
51
+	 * {@inheritDoc}
52
+	 * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\GeoAnalysisInterface::itemsDescription()
53
+	 */
54
+	public function itemsDescription(): callable
55
+	{
56
+		return fn(int $count): string => I18N::plural('event', 'events', $count);
57
+	}
58 58
 
59
-    /**
60
-     * {@inheritDoc}
61
-     * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\GeoAnalysisInterface::results()
62
-     */
63
-    public function results(Tree $tree, int $depth): GeoAnalysisResults
64
-    {
65
-        $results = new GeoAnalysisResults();
59
+	/**
60
+	 * {@inheritDoc}
61
+	 * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\GeoAnalysisInterface::results()
62
+	 */
63
+	public function results(Tree $tree, int $depth): GeoAnalysisResults
64
+	{
65
+		$results = new GeoAnalysisResults();
66 66
 
67
-        foreach ($this->geoanalysis_data_service->individualsAndFamilies($tree) as $record) {
68
-            foreach ($record->facts([]) as $fact) {
69
-                $place = new GeoAnalysisPlace($tree, $fact->place(), $depth);
70
-                if ($place->isUnknown()) {
71
-                    continue;
72
-                }
73
-                $results->addPlace($place);
74
-                $results->addPlaceInCategory($fact->label(), 0, $place);
75
-            }
76
-        }
67
+		foreach ($this->geoanalysis_data_service->individualsAndFamilies($tree) as $record) {
68
+			foreach ($record->facts([]) as $fact) {
69
+				$place = new GeoAnalysisPlace($tree, $fact->place(), $depth);
70
+				if ($place->isUnknown()) {
71
+					continue;
72
+				}
73
+				$results->addPlace($place);
74
+				$results->addPlaceInCategory($fact->label(), 0, $place);
75
+			}
76
+		}
77 77
 
78
-        return $results;
79
-    }
78
+		return $results;
79
+	}
80 80
 }
Please login to merge, or discard this patch.
Webtrees/Module/GeoDispersion/GeoAnalyses/AllEventsByCenturyGeoAnalysis.php 1 patch
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -28,66 +28,66 @@
 block discarded – undo
28 28
  */
29 29
 class AllEventsByCenturyGeoAnalysis implements GeoAnalysisInterface
30 30
 {
31
-    private GeoAnalysisDataService $geoanalysis_data_service;
32
-    private CenturyService $century_service;
31
+	private GeoAnalysisDataService $geoanalysis_data_service;
32
+	private CenturyService $century_service;
33 33
 
34
-    /**
35
-     * Constructor for AllEventsByCenturyGeoAnalysis
36
-     *
37
-     * @param GeoAnalysisDataService $geoanalysis_data_service
38
-     * @param CenturyService $century_service
39
-     */
40
-    public function __construct(GeoAnalysisDataService $geoanalysis_data_service, CenturyService $century_service)
41
-    {
42
-        $this->geoanalysis_data_service = $geoanalysis_data_service;
43
-        $this->century_service = $century_service;
44
-    }
34
+	/**
35
+	 * Constructor for AllEventsByCenturyGeoAnalysis
36
+	 *
37
+	 * @param GeoAnalysisDataService $geoanalysis_data_service
38
+	 * @param CenturyService $century_service
39
+	 */
40
+	public function __construct(GeoAnalysisDataService $geoanalysis_data_service, CenturyService $century_service)
41
+	{
42
+		$this->geoanalysis_data_service = $geoanalysis_data_service;
43
+		$this->century_service = $century_service;
44
+	}
45 45
 
46
-    /**
47
-     * {@inheritDoc}
48
-     * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\GeoAnalysisInterface::title()
49
-     */
50
-    public function title(): string
51
-    {
52
-        return I18N::translate('All events places');
53
-    }
46
+	/**
47
+	 * {@inheritDoc}
48
+	 * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\GeoAnalysisInterface::title()
49
+	 */
50
+	public function title(): string
51
+	{
52
+		return I18N::translate('All events places');
53
+	}
54 54
 
55
-    /**
56
-     * {@inheritDoc}
57
-     * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\GeoAnalysisInterface::itemsDescription()
58
-     */
59
-    public function itemsDescription(): callable
60
-    {
61
-        return fn(int $count): string => I18N::plural('event', 'events', $count);
62
-    }
55
+	/**
56
+	 * {@inheritDoc}
57
+	 * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\GeoAnalysisInterface::itemsDescription()
58
+	 */
59
+	public function itemsDescription(): callable
60
+	{
61
+		return fn(int $count): string => I18N::plural('event', 'events', $count);
62
+	}
63 63
 
64
-    /**
65
-     * {@inheritDoc}
66
-     * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\GeoAnalysisInterface::results()
67
-     */
68
-    public function results(Tree $tree, int $depth): GeoAnalysisResults
69
-    {
70
-        $results = new GeoAnalysisResults();
64
+	/**
65
+	 * {@inheritDoc}
66
+	 * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\GeoAnalysisInterface::results()
67
+	 */
68
+	public function results(Tree $tree, int $depth): GeoAnalysisResults
69
+	{
70
+		$results = new GeoAnalysisResults();
71 71
 
72
-        foreach ($this->geoanalysis_data_service->individualsAndFamilies($tree) as $record) {
73
-            foreach ($record->facts([]) as $fact) {
74
-                $place = new GeoAnalysisPlace($tree, $fact->place(), $depth);
75
-                if ($place->isUnknown()) {
76
-                    continue;
77
-                }
78
-                $results->addPlace($place);
79
-                $date = $fact->date();
80
-                if ($date->isOK()) {
81
-                    $century = intdiv($date->gregorianYear(), 100);
82
-                    $results->addPlaceInCategory(
83
-                        I18N::translate('%s century', $this->century_service->centuryName($century)),
84
-                        $century,
85
-                        $place
86
-                    );
87
-                }
88
-            }
89
-        }
72
+		foreach ($this->geoanalysis_data_service->individualsAndFamilies($tree) as $record) {
73
+			foreach ($record->facts([]) as $fact) {
74
+				$place = new GeoAnalysisPlace($tree, $fact->place(), $depth);
75
+				if ($place->isUnknown()) {
76
+					continue;
77
+				}
78
+				$results->addPlace($place);
79
+				$date = $fact->date();
80
+				if ($date->isOK()) {
81
+					$century = intdiv($date->gregorianYear(), 100);
82
+					$results->addPlaceInCategory(
83
+						I18N::translate('%s century', $this->century_service->centuryName($century)),
84
+						$century,
85
+						$place
86
+					);
87
+				}
88
+			}
89
+		}
90 90
 
91
-        return $results;
92
-    }
91
+		return $results;
92
+	}
93 93
 }
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/Schema/Migration1.php 2 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -24,35 +24,35 @@
 block discarded – undo
24 24
 class Migration1 implements MigrationInterface
25 25
 {
26 26
 
27
-    /**
28
-     * {@inheritDoc}
29
-     * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade()
30
-     */
31
-    public function upgrade(): void
32
-    {
33
-        DB::schema()->create('maj_geodisp_views', static function (Blueprint $table): void {
34
-            $table->integer('majgv_id')->autoIncrement();
35
-            $table->integer('majgv_gedcom_id')->index();
36
-            $table->string('majgv_view_class', 255);
37
-            $table->enum('majgv_status', ['enabled', 'disabled'])->default('enabled');
38
-            $table->string('majgv_descr', 248);
39
-            $table->string('majgv_analysis', 255);
40
-            $table->tinyInteger('majgv_place_depth')->default(1);
41
-            $table->tinyInteger('majgv_top_places')->default(0);
42
-            $table->json('majgv_colors')->nullable();
43
-
44
-            $table->foreign('majgv_gedcom_id')->references('gedcom_id')->on('gedcom')->onDelete('cascade');
45
-        });
46
-
47
-        DB::schema()->create('maj_geodisp_mapviews', static function (Blueprint $table): void {
48
-            $table->integer('majgm_id')->autoIncrement();
49
-            $table->integer('majgm_majgv_id')->index();
50
-            $table->string('majgm_map_id', 127);
51
-            $table->string('majgm_mapper', 255);
52
-            $table->string('majgm_feature_prop', 31);
53
-            $table->json('majgm_config')->nullable();
54
-
55
-            $table->foreign('majgm_majgv_id')->references('majgv_id')->on('maj_geodisp_views')->onDelete('cascade');
56
-        });
57
-    }
27
+	/**
28
+	 * {@inheritDoc}
29
+	 * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade()
30
+	 */
31
+	public function upgrade(): void
32
+	{
33
+		DB::schema()->create('maj_geodisp_views', static function (Blueprint $table): void {
34
+			$table->integer('majgv_id')->autoIncrement();
35
+			$table->integer('majgv_gedcom_id')->index();
36
+			$table->string('majgv_view_class', 255);
37
+			$table->enum('majgv_status', ['enabled', 'disabled'])->default('enabled');
38
+			$table->string('majgv_descr', 248);
39
+			$table->string('majgv_analysis', 255);
40
+			$table->tinyInteger('majgv_place_depth')->default(1);
41
+			$table->tinyInteger('majgv_top_places')->default(0);
42
+			$table->json('majgv_colors')->nullable();
43
+
44
+			$table->foreign('majgv_gedcom_id')->references('gedcom_id')->on('gedcom')->onDelete('cascade');
45
+		});
46
+
47
+		DB::schema()->create('maj_geodisp_mapviews', static function (Blueprint $table): void {
48
+			$table->integer('majgm_id')->autoIncrement();
49
+			$table->integer('majgm_majgv_id')->index();
50
+			$table->string('majgm_map_id', 127);
51
+			$table->string('majgm_mapper', 255);
52
+			$table->string('majgm_feature_prop', 31);
53
+			$table->json('majgm_config')->nullable();
54
+
55
+			$table->foreign('majgm_majgv_id')->references('majgv_id')->on('maj_geodisp_views')->onDelete('cascade');
56
+		});
57
+	}
58 58
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function upgrade(): void
32 32
     {
33
-        DB::schema()->create('maj_geodisp_views', static function (Blueprint $table): void {
33
+        DB::schema()->create('maj_geodisp_views', static function(Blueprint $table): void {
34 34
             $table->integer('majgv_id')->autoIncrement();
35 35
             $table->integer('majgv_gedcom_id')->index();
36 36
             $table->string('majgv_view_class', 255);
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
             $table->foreign('majgv_gedcom_id')->references('gedcom_id')->on('gedcom')->onDelete('cascade');
45 45
         });
46 46
 
47
-        DB::schema()->create('maj_geodisp_mapviews', static function (Blueprint $table): void {
47
+        DB::schema()->create('maj_geodisp_mapviews', static function(Blueprint $table): void {
48 48
             $table->integer('majgm_id')->autoIncrement();
49 49
             $table->integer('majgm_majgv_id')->index();
50 50
             $table->string('majgm_map_id', 127);
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/Schema/Migration0.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -22,12 +22,12 @@
 block discarded – undo
22 22
 class Migration0 implements MigrationInterface
23 23
 {
24 24
 
25
-    /**
26
-     * {@inheritDoc}
27
-     * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade()
28
-     */
29
-    public function upgrade(): void
30
-    {
31
-        // This migration has been superseded by migration 1.
32
-    }
25
+	/**
26
+	 * {@inheritDoc}
27
+	 * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade()
28
+	 */
29
+	public function upgrade(): void
30
+	{
31
+		// This migration has been superseded by migration 1.
32
+	}
33 33
 }
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/Services/MapDefinitionsService.php 2 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -25,46 +25,46 @@
 block discarded – undo
25 25
  */
26 26
 class MapDefinitionsService
27 27
 {
28
-    private ModuleService $module_service;
28
+	private ModuleService $module_service;
29 29
 
30
-    /**
31
-     * Constructor for MapDefinitionsService
32
-     *
33
-     * @param ModuleService $module_service
34
-     */
35
-    public function __construct(ModuleService $module_service)
36
-    {
37
-        $this->module_service = $module_service;
38
-    }
30
+	/**
31
+	 * Constructor for MapDefinitionsService
32
+	 *
33
+	 * @param ModuleService $module_service
34
+	 */
35
+	public function __construct(ModuleService $module_service)
36
+	{
37
+		$this->module_service = $module_service;
38
+	}
39 39
 
40
-    /**
41
-     * Find a map definition by ID.
42
-     *
43
-     * @param string $id
44
-     * @return MapDefinitionInterface|NULL
45
-     */
46
-    public function find(string $id): ?MapDefinitionInterface
47
-    {
48
-        return $this->all()->get($id);
49
-    }
40
+	/**
41
+	 * Find a map definition by ID.
42
+	 *
43
+	 * @param string $id
44
+	 * @return MapDefinitionInterface|NULL
45
+	 */
46
+	public function find(string $id): ?MapDefinitionInterface
47
+	{
48
+		return $this->all()->get($id);
49
+	}
50 50
 
51
-    /**
52
-     * Get all map definitions available.
53
-     *
54
-     * {@internal The list is generated based on the modules exposing ModuleMapDefinitionProviderInterface,
55
-     * and the result is cached}
56
-     *
57
-     * @param bool $include_disabled
58
-     * @return Collection<string, MapDefinitionInterface>
59
-     */
60
-    public function all(bool $include_disabled = false): Collection
61
-    {
62
-        return Registry::cache()->array()->remember(
63
-            'maj-geodisp-maps-all',
64
-            fn() => $this->module_service
65
-                ->findByInterface(ModuleMapDefinitionProviderInterface::class, $include_disabled)
66
-                ->flatMap(fn(ModuleMapDefinitionProviderInterface $module) => $module->listMapDefinition())
67
-                ->mapWithKeys(fn(MapDefinitionInterface $map) => [ $map->id() => $map ])
68
-        );
69
-    }
51
+	/**
52
+	 * Get all map definitions available.
53
+	 *
54
+	 * {@internal The list is generated based on the modules exposing ModuleMapDefinitionProviderInterface,
55
+	 * and the result is cached}
56
+	 *
57
+	 * @param bool $include_disabled
58
+	 * @return Collection<string, MapDefinitionInterface>
59
+	 */
60
+	public function all(bool $include_disabled = false): Collection
61
+	{
62
+		return Registry::cache()->array()->remember(
63
+			'maj-geodisp-maps-all',
64
+			fn() => $this->module_service
65
+				->findByInterface(ModuleMapDefinitionProviderInterface::class, $include_disabled)
66
+				->flatMap(fn(ModuleMapDefinitionProviderInterface $module) => $module->listMapDefinition())
67
+				->mapWithKeys(fn(MapDefinitionInterface $map) => [ $map->id() => $map ])
68
+		);
69
+	}
70 70
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
             fn() => $this->module_service
65 65
                 ->findByInterface(ModuleMapDefinitionProviderInterface::class, $include_disabled)
66 66
                 ->flatMap(fn(ModuleMapDefinitionProviderInterface $module) => $module->listMapDefinition())
67
-                ->mapWithKeys(fn(MapDefinitionInterface $map) => [ $map->id() => $map ])
67
+                ->mapWithKeys(fn(MapDefinitionInterface $map) => [$map->id() => $map])
68 68
         );
69 69
     }
70 70
 }
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/Services/GeoAnalysisDataService.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -25,28 +25,28 @@
 block discarded – undo
25 25
  */
26 26
 class GeoAnalysisDataService
27 27
 {
28
-    /**
29
-     * Yields indviduals and family records for a specified tree.
30
-     *
31
-     * @param Tree $tree
32
-     * @return \Generator<\Fisharebest\Webtrees\GedcomRecord>
33
-     */
34
-    public function individualsAndFamilies(Tree $tree): Generator
35
-    {
36
-        yield from DB::table('individuals')
37
-            ->where('i_file', '=', $tree->id())
38
-            ->select(['individuals.*'])
39
-            ->get()
40
-            ->map(Registry::individualFactory()->mapper($tree))
41
-            ->filter(GedcomRecord::accessFilter())
42
-            ->all();
28
+	/**
29
+	 * Yields indviduals and family records for a specified tree.
30
+	 *
31
+	 * @param Tree $tree
32
+	 * @return \Generator<\Fisharebest\Webtrees\GedcomRecord>
33
+	 */
34
+	public function individualsAndFamilies(Tree $tree): Generator
35
+	{
36
+		yield from DB::table('individuals')
37
+			->where('i_file', '=', $tree->id())
38
+			->select(['individuals.*'])
39
+			->get()
40
+			->map(Registry::individualFactory()->mapper($tree))
41
+			->filter(GedcomRecord::accessFilter())
42
+			->all();
43 43
 
44
-        yield from DB::table('families')
45
-            ->where('f_file', '=', $tree->id())
46
-            ->select(['families.*'])
47
-            ->get()
48
-            ->map(Registry::familyFactory()->mapper($tree))
49
-            ->filter(GedcomRecord::accessFilter())
50
-            ->all();
51
-    }
44
+		yield from DB::table('families')
45
+			->where('f_file', '=', $tree->id())
46
+			->select(['families.*'])
47
+			->get()
48
+			->map(Registry::familyFactory()->mapper($tree))
49
+			->filter(GedcomRecord::accessFilter())
50
+			->all();
51
+	}
52 52
 }
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/Services/PlacesReferenceTableService.php 2 patches
Indentation   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -21,102 +21,102 @@
 block discarded – undo
21 21
  */
22 22
 class PlacesReferenceTableService
23 23
 {
24
-    /**
25
-     * Mapping format placeholder tags => table column names
26
-     * @var array<string, string>
27
-     */
28
-    private const COLUMN_MAPPING = [
29
-        'name'  =>  'majgr_place_name',
30
-        'id'    =>  'majgr_place_admin_id',
31
-        'zip'   =>  'majgr_place_zip',
32
-        'gov'   =>  'majgr_place_gov_id',
33
-        'mls'   =>  'majgr_place_mls_id'
34
-    ];
24
+	/**
25
+	 * Mapping format placeholder tags => table column names
26
+	 * @var array<string, string>
27
+	 */
28
+	private const COLUMN_MAPPING = [
29
+		'name'  =>  'majgr_place_name',
30
+		'id'    =>  'majgr_place_admin_id',
31
+		'zip'   =>  'majgr_place_zip',
32
+		'gov'   =>  'majgr_place_gov_id',
33
+		'mls'   =>  'majgr_place_mls_id'
34
+	];
35 35
 
36
-    /**
37
-     * Get the formatted target mapping value of a place defined by a source format.
38
-     *
39
-     * @param string $source
40
-     * @param string $source_format
41
-     * @param string $target_format
42
-     * @return string|NULL
43
-     */
44
-    public function targetId(string $source, string $source_format, string $target_format): ?string
45
-    {
46
-        // Extract parts for the WHERE clause
47
-        $source_format = str_replace(['{', '}'], ['{#', '#}'], $source_format);
48
-        $source_parts = preg_split('/[{}]/i', $source_format);
49
-        if ($source_parts === false) {
50
-            return null;
51
-        }
52
-        $source_parts = array_map(function (string $part): string {
53
-            if (preg_match('/^#([^#]+)#$/i', $part, $column_id) === 1) {
54
-                return $this->columnName($column_id[1]);
55
-            }
56
-            return $this->sanitizeString(str_replace(['?', '*'], ['_', '%'], $part));
57
-        }, array_filter($source_parts));
58
-        $source_parts[] = "'%'";
59
-        $concat_statement = 'CONCAT(' . implode(', ', $source_parts) . ')';
36
+	/**
37
+	 * Get the formatted target mapping value of a place defined by a source format.
38
+	 *
39
+	 * @param string $source
40
+	 * @param string $source_format
41
+	 * @param string $target_format
42
+	 * @return string|NULL
43
+	 */
44
+	public function targetId(string $source, string $source_format, string $target_format): ?string
45
+	{
46
+		// Extract parts for the WHERE clause
47
+		$source_format = str_replace(['{', '}'], ['{#', '#}'], $source_format);
48
+		$source_parts = preg_split('/[{}]/i', $source_format);
49
+		if ($source_parts === false) {
50
+			return null;
51
+		}
52
+		$source_parts = array_map(function (string $part): string {
53
+			if (preg_match('/^#([^#]+)#$/i', $part, $column_id) === 1) {
54
+				return $this->columnName($column_id[1]);
55
+			}
56
+			return $this->sanitizeString(str_replace(['?', '*'], ['_', '%'], $part));
57
+		}, array_filter($source_parts));
58
+		$source_parts[] = "'%'";
59
+		$concat_statement = 'CONCAT(' . implode(', ', $source_parts) . ')';
60 60
 
61
-        // Extract columns used in target
62
-        $columns = [];
63
-        if (preg_match_all('/{(.*?)}/i', $target_format, $columns_select) === 1) {
64
-            $columns = array_unique(array_filter(array_map(fn($id) => $this->columnName($id), $columns_select[1])));
65
-        }
61
+		// Extract columns used in target
62
+		$columns = [];
63
+		if (preg_match_all('/{(.*?)}/i', $target_format, $columns_select) === 1) {
64
+			$columns = array_unique(array_filter(array_map(fn($id) => $this->columnName($id), $columns_select[1])));
65
+		}
66 66
 
67
-        // Get the mapping
68
-        $rows = DB::table('maj_geodata_ref')  //DB::table('maj_geodata_ref')
69
-            ->select($columns)
70
-            ->whereRaw($this->sanitizeString($source) . " LIKE " . $concat_statement)
71
-            ->get();
67
+		// Get the mapping
68
+		$rows = DB::table('maj_geodata_ref')  //DB::table('maj_geodata_ref')
69
+			->select($columns)
70
+			->whereRaw($this->sanitizeString($source) . " LIKE " . $concat_statement)
71
+			->get();
72 72
 
73
-        // Format the output ID
74
-        if ($rows->count() === 0) {
75
-            return null;
76
-        }
73
+		// Format the output ID
74
+		if ($rows->count() === 0) {
75
+			return null;
76
+		}
77 77
 
78
-        $mapping = (array) $rows->first();
79
-        if (count($columns_select) === 0) {
80
-            return $target_format;
81
-        }
78
+		$mapping = (array) $rows->first();
79
+		if (count($columns_select) === 0) {
80
+			return $target_format;
81
+		}
82 82
 
83
-        return str_replace(
84
-            array_map(fn($tag) => '{' . $tag . '}', $columns_select[1]),
85
-            array_map(fn($tag) => $mapping[$this->columnName($tag)] ?? '', $columns_select[1]),
86
-            $target_format
87
-        );
88
-    }
83
+		return str_replace(
84
+			array_map(fn($tag) => '{' . $tag . '}', $columns_select[1]),
85
+			array_map(fn($tag) => $mapping[$this->columnName($tag)] ?? '', $columns_select[1]),
86
+			$target_format
87
+		);
88
+	}
89 89
 
90
-    /**
91
-     * Get the column name for a format placeholder tag
92
-     *
93
-     * @param string $placeholder
94
-     * @return string
95
-     */
96
-    private function columnName(string $placeholder): string
97
-    {
98
-        return self::COLUMN_MAPPING[$placeholder] ?? '';
99
-    }
90
+	/**
91
+	 * Get the column name for a format placeholder tag
92
+	 *
93
+	 * @param string $placeholder
94
+	 * @return string
95
+	 */
96
+	private function columnName(string $placeholder): string
97
+	{
98
+		return self::COLUMN_MAPPING[$placeholder] ?? '';
99
+	}
100 100
 
101
-    /**
102
-     * Get the placeholder tag for a column_name
103
-     *
104
-     * @param string $column_name
105
-     * @return string
106
-     */
107
-    private function tagName(string $column_name): string
108
-    {
109
-        return array_flip(self::COLUMN_MAPPING)[$column_name] ?? '';
110
-    }
101
+	/**
102
+	 * Get the placeholder tag for a column_name
103
+	 *
104
+	 * @param string $column_name
105
+	 * @return string
106
+	 */
107
+	private function tagName(string $column_name): string
108
+	{
109
+		return array_flip(self::COLUMN_MAPPING)[$column_name] ?? '';
110
+	}
111 111
 
112
-    /**
113
-     * Sanitize string for use in a SQL query.
114
-     *
115
-     * @param string $string
116
-     * @return string
117
-     */
118
-    private function sanitizeString(string $string): string
119
-    {
120
-        return DB::connection()->getPdo()->quote($string);
121
-    }
112
+	/**
113
+	 * Sanitize string for use in a SQL query.
114
+	 *
115
+	 * @param string $string
116
+	 * @return string
117
+	 */
118
+	private function sanitizeString(string $string): string
119
+	{
120
+		return DB::connection()->getPdo()->quote($string);
121
+	}
122 122
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -49,14 +49,14 @@  discard block
 block discarded – undo
49 49
         if ($source_parts === false) {
50 50
             return null;
51 51
         }
52
-        $source_parts = array_map(function (string $part): string {
52
+        $source_parts = array_map(function(string $part): string {
53 53
             if (preg_match('/^#([^#]+)#$/i', $part, $column_id) === 1) {
54 54
                 return $this->columnName($column_id[1]);
55 55
             }
56 56
             return $this->sanitizeString(str_replace(['?', '*'], ['_', '%'], $part));
57 57
         }, array_filter($source_parts));
58 58
         $source_parts[] = "'%'";
59
-        $concat_statement = 'CONCAT(' . implode(', ', $source_parts) . ')';
59
+        $concat_statement = 'CONCAT('.implode(', ', $source_parts).')';
60 60
 
61 61
         // Extract columns used in target
62 62
         $columns = [];
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         // Get the mapping
68 68
         $rows = DB::table('maj_geodata_ref')  //DB::table('maj_geodata_ref')
69 69
             ->select($columns)
70
-            ->whereRaw($this->sanitizeString($source) . " LIKE " . $concat_statement)
70
+            ->whereRaw($this->sanitizeString($source)." LIKE ".$concat_statement)
71 71
             ->get();
72 72
 
73 73
         // Format the output ID
@@ -75,13 +75,13 @@  discard block
 block discarded – undo
75 75
             return null;
76 76
         }
77 77
 
78
-        $mapping = (array) $rows->first();
78
+        $mapping = (array)$rows->first();
79 79
         if (count($columns_select) === 0) {
80 80
             return $target_format;
81 81
         }
82 82
 
83 83
         return str_replace(
84
-            array_map(fn($tag) => '{' . $tag . '}', $columns_select[1]),
84
+            array_map(fn($tag) => '{'.$tag.'}', $columns_select[1]),
85 85
             array_map(fn($tag) => $mapping[$this->columnName($tag)] ?? '', $columns_select[1]),
86 86
             $target_format
87 87
         );
Please login to merge, or discard this patch.