Passed
Push — feature/code-analysis ( a2ce2d...28b704 )
by Jonathan
04:31
created
app/Module/GeoDispersion/Http/RequestHandlers/MapAdapterAddPage.php 2 patches
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -33,68 +33,68 @@
 block discarded – undo
33 33
  */
34 34
 class MapAdapterAddPage implements RequestHandlerInterface
35 35
 {
36
-    use ViewResponseTrait;
36
+	use ViewResponseTrait;
37 37
 
38
-    private ?GeoDispersionModule $module;
39
-    private GeoAnalysisViewDataService $geoview_data_service;
40
-    private MapDefinitionsService $map_definition_service;
41
-    private PlaceMapperService $place_mapper_service;
38
+	private ?GeoDispersionModule $module;
39
+	private GeoAnalysisViewDataService $geoview_data_service;
40
+	private MapDefinitionsService $map_definition_service;
41
+	private PlaceMapperService $place_mapper_service;
42 42
 
43
-    /**
44
-     * Constructor for MapAdapterAddPage Request Handler
45
-     *
46
-     * @param ModuleService $module_service
47
-     * @param GeoAnalysisViewDataService $geoview_data_service
48
-     * @param MapDefinitionsService $map_definition_service
49
-     * @param PlaceMapperService $place_mapper_service
50
-     */
51
-    public function __construct(
52
-        ModuleService $module_service,
53
-        GeoAnalysisViewDataService $geoview_data_service,
54
-        MapDefinitionsService $map_definition_service,
55
-        PlaceMapperService $place_mapper_service
56
-    ) {
57
-        $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
58
-        $this->geoview_data_service = $geoview_data_service;
59
-        $this->map_definition_service = $map_definition_service;
60
-        $this->place_mapper_service = $place_mapper_service;
61
-    }
43
+	/**
44
+	 * Constructor for MapAdapterAddPage Request Handler
45
+	 *
46
+	 * @param ModuleService $module_service
47
+	 * @param GeoAnalysisViewDataService $geoview_data_service
48
+	 * @param MapDefinitionsService $map_definition_service
49
+	 * @param PlaceMapperService $place_mapper_service
50
+	 */
51
+	public function __construct(
52
+		ModuleService $module_service,
53
+		GeoAnalysisViewDataService $geoview_data_service,
54
+		MapDefinitionsService $map_definition_service,
55
+		PlaceMapperService $place_mapper_service
56
+	) {
57
+		$this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
58
+		$this->geoview_data_service = $geoview_data_service;
59
+		$this->map_definition_service = $map_definition_service;
60
+		$this->place_mapper_service = $place_mapper_service;
61
+	}
62 62
 
63
-    /**
64
-     * {@inheritDoc}
65
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
66
-     */
67
-    public function handle(ServerRequestInterface $request): ResponseInterface
68
-    {
69
-        $this->layout = 'layouts/administration';
63
+	/**
64
+	 * {@inheritDoc}
65
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
66
+	 */
67
+	public function handle(ServerRequestInterface $request): ResponseInterface
68
+	{
69
+		$this->layout = 'layouts/administration';
70 70
 
71
-        if ($this->module === null) {
72
-            throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
73
-        }
71
+		if ($this->module === null) {
72
+			throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
73
+		}
74 74
 
75
-        $tree = Validator::attributes($request)->tree();
75
+		$tree = Validator::attributes($request)->tree();
76 76
 
77
-        $view_id = Validator::attributes($request)->integer('view_id', -1);
78
-        $view = $this->geoview_data_service->find($tree, $view_id, true);
77
+		$view_id = Validator::attributes($request)->integer('view_id', -1);
78
+		$view = $this->geoview_data_service->find($tree, $view_id, true);
79 79
 
80
-        if ($view === null) {
81
-            throw new HttpNotFoundException(
82
-                I18N::translate('The geographical dispersion analysis view could not be found.')
83
-            );
84
-        }
80
+		if ($view === null) {
81
+			throw new HttpNotFoundException(
82
+				I18N::translate('The geographical dispersion analysis view could not be found.')
83
+			);
84
+		}
85 85
 
86
-        return $this->viewResponse($this->module->name() . '::admin/map-adapter-edit', [
87
-            'module'            =>  $this->module,
88
-            'title'             =>  I18N::translate('Add a map configuration'),
89
-            'tree'              =>  $tree,
90
-            'view_id'           =>  $view_id,
91
-            'map_adapter'       =>  null,
92
-            'maps_list'         =>  $this->map_definition_service->all(),
93
-            'mappers_list'      =>  $this->place_mapper_service->all(),
94
-            'route_edit'        =>  route(MapAdapterAddAction::class, [
95
-                                        'tree'      => $tree->name(),
96
-                                        'view_id'   => $view_id
97
-                                    ])
98
-        ]);
99
-    }
86
+		return $this->viewResponse($this->module->name() . '::admin/map-adapter-edit', [
87
+			'module'            =>  $this->module,
88
+			'title'             =>  I18N::translate('Add a map configuration'),
89
+			'tree'              =>  $tree,
90
+			'view_id'           =>  $view_id,
91
+			'map_adapter'       =>  null,
92
+			'maps_list'         =>  $this->map_definition_service->all(),
93
+			'mappers_list'      =>  $this->place_mapper_service->all(),
94
+			'route_edit'        =>  route(MapAdapterAddAction::class, [
95
+										'tree'      => $tree->name(),
96
+										'view_id'   => $view_id
97
+									])
98
+		]);
99
+	}
100 100
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@
 block discarded – undo
83 83
             );
84 84
         }
85 85
 
86
-        return $this->viewResponse($this->module->name() . '::admin/map-adapter-edit', [
86
+        return $this->viewResponse($this->module->name().'::admin/map-adapter-edit', [
87 87
             'module'            =>  $this->module,
88 88
             'title'             =>  I18N::translate('Add a map configuration'),
89 89
             'tree'              =>  $tree,
Please login to merge, or discard this patch.
app/Module/GeoDispersion/Http/RequestHandlers/MapAdapterDeleteAction.php 2 patches
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -31,69 +31,69 @@
 block discarded – undo
31 31
  */
32 32
 class MapAdapterDeleteAction implements RequestHandlerInterface
33 33
 {
34
-    private ?GeoDispersionModule $module;
35
-    private MapAdapterDataService $mapadapter_data_service;
34
+	private ?GeoDispersionModule $module;
35
+	private MapAdapterDataService $mapadapter_data_service;
36 36
 
37
-    /**
38
-     * Constructor for MapAdapterDeleteAction Request Handler
39
-     *
40
-     * @param ModuleService $module_service
41
-     * @param MapAdapterDataService $mapadapter_data_service
42
-     */
43
-    public function __construct(ModuleService $module_service, MapAdapterDataService $mapadapter_data_service)
44
-    {
45
-        $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
46
-        $this->mapadapter_data_service = $mapadapter_data_service;
47
-    }
37
+	/**
38
+	 * Constructor for MapAdapterDeleteAction Request Handler
39
+	 *
40
+	 * @param ModuleService $module_service
41
+	 * @param MapAdapterDataService $mapadapter_data_service
42
+	 */
43
+	public function __construct(ModuleService $module_service, MapAdapterDataService $mapadapter_data_service)
44
+	{
45
+		$this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
46
+		$this->mapadapter_data_service = $mapadapter_data_service;
47
+	}
48 48
 
49
-    /**
50
-     * {@inheritDoc}
51
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
52
-     */
53
-    public function handle(ServerRequestInterface $request): ResponseInterface
54
-    {
55
-        $tree = Validator::attributes($request)->tree();
49
+	/**
50
+	 * {@inheritDoc}
51
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
52
+	 */
53
+	public function handle(ServerRequestInterface $request): ResponseInterface
54
+	{
55
+		$tree = Validator::attributes($request)->tree();
56 56
 
57
-        $admin_config_route = route(AdminConfigPage::class, ['tree' => $tree->name()]);
57
+		$admin_config_route = route(AdminConfigPage::class, ['tree' => $tree->name()]);
58 58
 
59
-        if ($this->module === null) {
60
-            FlashMessages::addMessage(
61
-                I18N::translate('The attached module could not be found.'),
62
-                'danger'
63
-            );
64
-            return redirect($admin_config_route);
65
-        }
59
+		if ($this->module === null) {
60
+			FlashMessages::addMessage(
61
+				I18N::translate('The attached module could not be found.'),
62
+				'danger'
63
+			);
64
+			return redirect($admin_config_route);
65
+		}
66 66
 
67
-        $adapter_id = Validator::attributes($request)->integer('adapter_id', -1);
68
-        $map_adapter = $this->mapadapter_data_service->find($adapter_id);
67
+		$adapter_id = Validator::attributes($request)->integer('adapter_id', -1);
68
+		$map_adapter = $this->mapadapter_data_service->find($adapter_id);
69 69
 
70
-        if ($map_adapter === null) {
71
-            FlashMessages::addMessage(
72
-                I18N::translate('The map configuration with ID “%d” does not exist.', I18N::number($adapter_id)),
73
-                'danger'
74
-            );
75
-            return redirect($admin_config_route);
76
-        }
70
+		if ($map_adapter === null) {
71
+			FlashMessages::addMessage(
72
+				I18N::translate('The map configuration with ID “%d” does not exist.', I18N::number($adapter_id)),
73
+				'danger'
74
+			);
75
+			return redirect($admin_config_route);
76
+		}
77 77
 
78
-        if ($this->mapadapter_data_service->delete($map_adapter) > 0) {
79
-            FlashMessages::addMessage(
80
-                I18N::translate('The map configuration has been successfully deleted.'),
81
-                'success'
82
-            );
83
-            //phpcs:ignore Generic.Files.LineLength.TooLong
84
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $map_adapter->id() . '” has been deleted.');
85
-        } else {
86
-            FlashMessages::addMessage(
87
-                I18N::translate('An error occured while deleting the map configuration.'),
88
-                'danger'
89
-            );
90
-            //phpcs:ignore Generic.Files.LineLength.TooLong
91
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $map_adapter->id() . '” could not be deleted. See error log.');
92
-        }
78
+		if ($this->mapadapter_data_service->delete($map_adapter) > 0) {
79
+			FlashMessages::addMessage(
80
+				I18N::translate('The map configuration has been successfully deleted.'),
81
+				'success'
82
+			);
83
+			//phpcs:ignore Generic.Files.LineLength.TooLong
84
+			Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $map_adapter->id() . '” has been deleted.');
85
+		} else {
86
+			FlashMessages::addMessage(
87
+				I18N::translate('An error occured while deleting the map configuration.'),
88
+				'danger'
89
+			);
90
+			//phpcs:ignore Generic.Files.LineLength.TooLong
91
+			Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $map_adapter->id() . '” could not be deleted. See error log.');
92
+		}
93 93
 
94
-        return redirect(route(GeoAnalysisViewEditPage::class, [
95
-            'tree'      => $tree->name(),
96
-            'view_id'   => $map_adapter->geoAnalysisViewId()
97
-        ]));
98
-    }
94
+		return redirect(route(GeoAnalysisViewEditPage::class, [
95
+			'tree'      => $tree->name(),
96
+			'view_id'   => $map_adapter->geoAnalysisViewId()
97
+		]));
98
+	}
99 99
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -81,14 +81,14 @@
 block discarded – undo
81 81
                 'success'
82 82
             );
83 83
             //phpcs:ignore Generic.Files.LineLength.TooLong
84
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $map_adapter->id() . '” has been deleted.');
84
+            Log::addConfigurationLog('Module '.$this->module->title().' : Map Adapter “'.$map_adapter->id().'” has been deleted.');
85 85
         } else {
86 86
             FlashMessages::addMessage(
87 87
                 I18N::translate('An error occured while deleting the map configuration.'),
88 88
                 'danger'
89 89
             );
90 90
             //phpcs:ignore Generic.Files.LineLength.TooLong
91
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $map_adapter->id() . '” could not be deleted. See error log.');
91
+            Log::addConfigurationLog('Module '.$this->module->title().' : Map Adapter “'.$map_adapter->id().'” could not be deleted. See error log.');
92 92
         }
93 93
 
94 94
         return redirect(route(GeoAnalysisViewEditPage::class, [
Please login to merge, or discard this patch.
app/Module/GeoDispersion/Http/RequestHandlers/MapAdapterAddAction.php 2 patches
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -37,95 +37,95 @@
 block discarded – undo
37 37
  */
38 38
 class MapAdapterAddAction implements RequestHandlerInterface
39 39
 {
40
-    private ?GeoDispersionModule $module;
41
-    private GeoAnalysisViewDataService $geoview_data_service;
42
-    private MapAdapterDataService $mapadapter_data_service;
43
-    private MapDefinitionsService $map_definition_service;
40
+	private ?GeoDispersionModule $module;
41
+	private GeoAnalysisViewDataService $geoview_data_service;
42
+	private MapAdapterDataService $mapadapter_data_service;
43
+	private MapDefinitionsService $map_definition_service;
44 44
 
45
-    /**
46
-     * Constructor for MapAdapterAddAction Request Handler
47
-     *
48
-     * @param ModuleService $module_service
49
-     * @param GeoAnalysisViewDataService $geoview_data_service
50
-     * @param MapAdapterDataService $mapadapter_data_service
51
-     * @param MapDefinitionsService $map_definition_service
52
-     */
53
-    public function __construct(
54
-        ModuleService $module_service,
55
-        GeoAnalysisViewDataService $geoview_data_service,
56
-        MapAdapterDataService $mapadapter_data_service,
57
-        MapDefinitionsService $map_definition_service
58
-    ) {
59
-        $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
60
-        $this->geoview_data_service = $geoview_data_service;
61
-        $this->mapadapter_data_service = $mapadapter_data_service;
62
-        $this->map_definition_service = $map_definition_service;
63
-    }
45
+	/**
46
+	 * Constructor for MapAdapterAddAction Request Handler
47
+	 *
48
+	 * @param ModuleService $module_service
49
+	 * @param GeoAnalysisViewDataService $geoview_data_service
50
+	 * @param MapAdapterDataService $mapadapter_data_service
51
+	 * @param MapDefinitionsService $map_definition_service
52
+	 */
53
+	public function __construct(
54
+		ModuleService $module_service,
55
+		GeoAnalysisViewDataService $geoview_data_service,
56
+		MapAdapterDataService $mapadapter_data_service,
57
+		MapDefinitionsService $map_definition_service
58
+	) {
59
+		$this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
60
+		$this->geoview_data_service = $geoview_data_service;
61
+		$this->mapadapter_data_service = $mapadapter_data_service;
62
+		$this->map_definition_service = $map_definition_service;
63
+	}
64 64
 
65
-    /**
66
-     * {@inheritDoc}
67
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
68
-     */
69
-    public function handle(ServerRequestInterface $request): ResponseInterface
70
-    {
71
-        $tree = Validator::attributes($request)->tree();
65
+	/**
66
+	 * {@inheritDoc}
67
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
68
+	 */
69
+	public function handle(ServerRequestInterface $request): ResponseInterface
70
+	{
71
+		$tree = Validator::attributes($request)->tree();
72 72
 
73
-        if ($this->module === null) {
74
-            FlashMessages::addMessage(
75
-                I18N::translate('The attached module could not be found.'),
76
-                'danger'
77
-            );
78
-            return redirect(route(AdminConfigPage::class, ['tree' => $tree->name()]));
79
-        }
73
+		if ($this->module === null) {
74
+			FlashMessages::addMessage(
75
+				I18N::translate('The attached module could not be found.'),
76
+				'danger'
77
+			);
78
+			return redirect(route(AdminConfigPage::class, ['tree' => $tree->name()]));
79
+		}
80 80
 
81
-        $view_id = Validator::attributes($request)->integer('view_id', -1);
82
-        $view = $this->geoview_data_service->find($tree, $view_id);
81
+		$view_id = Validator::attributes($request)->integer('view_id', -1);
82
+		$view = $this->geoview_data_service->find($tree, $view_id);
83 83
 
84
-        $map = $this->map_definition_service->find(Validator::parsedBody($request)->string('map_adapter_map', ''));
85
-        $mapping_property   = Validator::parsedBody($request)->string('map_adapter_property_selected', '');
84
+		$map = $this->map_definition_service->find(Validator::parsedBody($request)->string('map_adapter_map', ''));
85
+		$mapping_property   = Validator::parsedBody($request)->string('map_adapter_property_selected', '');
86 86
 
87
-        $mapper = null;
88
-        try {
89
-            $mapper = app(Validator::parsedBody($request)->string('map_adapter_mapper', ''));
90
-        } catch (BindingResolutionException $ex) {
91
-        }
87
+		$mapper = null;
88
+		try {
89
+			$mapper = app(Validator::parsedBody($request)->string('map_adapter_mapper', ''));
90
+		} catch (BindingResolutionException $ex) {
91
+		}
92 92
 
93
-        if ($view === null || $map === null || $mapper === null || !($mapper instanceof PlaceMapperInterface)) {
94
-            FlashMessages::addMessage(
95
-                I18N::translate('The parameters for the map configuration are not valid.'),
96
-                'danger'
97
-            );
98
-            return redirect(route(AdminConfigPage::class, ['tree' => $tree->name()]));
99
-        }
93
+		if ($view === null || $map === null || $mapper === null || !($mapper instanceof PlaceMapperInterface)) {
94
+			FlashMessages::addMessage(
95
+				I18N::translate('The parameters for the map configuration are not valid.'),
96
+				'danger'
97
+			);
98
+			return redirect(route(AdminConfigPage::class, ['tree' => $tree->name()]));
99
+		}
100 100
 
101
-        $new_adapter_id = $this->mapadapter_data_service->insertGetId(
102
-            new GeoAnalysisMapAdapter(
103
-                0,
104
-                $view_id,
105
-                $map,
106
-                $mapper,
107
-                new MapViewConfig($mapping_property, $mapper->config()->withConfigUpdate($request))
108
-            )
109
-        );
110
-        if ($new_adapter_id > 0) {
111
-            FlashMessages::addMessage(
112
-                I18N::translate('The map configuration has been successfully added.'),
113
-                'success'
114
-            );
115
-            //phpcs:ignore Generic.Files.LineLength.TooLong
116
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $new_adapter_id . '” has been added.');
117
-        } else {
118
-            FlashMessages::addMessage(
119
-                I18N::translate('An error occured while adding a new map configuration.'),
120
-                'danger'
121
-            );
122
-            //phpcs:ignore Generic.Files.LineLength.TooLong
123
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter could not be added. See error log.');
124
-        }
101
+		$new_adapter_id = $this->mapadapter_data_service->insertGetId(
102
+			new GeoAnalysisMapAdapter(
103
+				0,
104
+				$view_id,
105
+				$map,
106
+				$mapper,
107
+				new MapViewConfig($mapping_property, $mapper->config()->withConfigUpdate($request))
108
+			)
109
+		);
110
+		if ($new_adapter_id > 0) {
111
+			FlashMessages::addMessage(
112
+				I18N::translate('The map configuration has been successfully added.'),
113
+				'success'
114
+			);
115
+			//phpcs:ignore Generic.Files.LineLength.TooLong
116
+			Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $new_adapter_id . '” has been added.');
117
+		} else {
118
+			FlashMessages::addMessage(
119
+				I18N::translate('An error occured while adding a new map configuration.'),
120
+				'danger'
121
+			);
122
+			//phpcs:ignore Generic.Files.LineLength.TooLong
123
+			Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter could not be added. See error log.');
124
+		}
125 125
 
126
-        return redirect(route(GeoAnalysisViewEditPage::class, [
127
-            'tree' => $tree->name(),
128
-            'view_id' => $view_id
129
-        ]));
130
-    }
126
+		return redirect(route(GeoAnalysisViewEditPage::class, [
127
+			'tree' => $tree->name(),
128
+			'view_id' => $view_id
129
+		]));
130
+	}
131 131
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         $view = $this->geoview_data_service->find($tree, $view_id);
83 83
 
84 84
         $map = $this->map_definition_service->find(Validator::parsedBody($request)->string('map_adapter_map', ''));
85
-        $mapping_property   = Validator::parsedBody($request)->string('map_adapter_property_selected', '');
85
+        $mapping_property = Validator::parsedBody($request)->string('map_adapter_property_selected', '');
86 86
 
87 87
         $mapper = null;
88 88
         try {
@@ -113,14 +113,14 @@  discard block
 block discarded – undo
113 113
                 'success'
114 114
             );
115 115
             //phpcs:ignore Generic.Files.LineLength.TooLong
116
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $new_adapter_id . '” has been added.');
116
+            Log::addConfigurationLog('Module '.$this->module->title().' : Map Adapter “'.$new_adapter_id.'” has been added.');
117 117
         } else {
118 118
             FlashMessages::addMessage(
119 119
                 I18N::translate('An error occured while adding a new map configuration.'),
120 120
                 'danger'
121 121
             );
122 122
             //phpcs:ignore Generic.Files.LineLength.TooLong
123
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter could not be added. See error log.');
123
+            Log::addConfigurationLog('Module '.$this->module->title().' : Map Adapter could not be added. See error log.');
124 124
         }
125 125
 
126 126
         return redirect(route(GeoAnalysisViewEditPage::class, [
Please login to merge, or discard this patch.
app/Module/GeoDispersion/Http/RequestHandlers/GeoAnalysisViewPage.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -32,42 +32,42 @@
 block discarded – undo
32 32
  */
33 33
 class GeoAnalysisViewPage implements RequestHandlerInterface
34 34
 {
35
-    use ViewResponseTrait;
35
+	use ViewResponseTrait;
36 36
 
37
-    private ?GeoDispersionModule $module;
38
-    private GeoAnalysisViewDataService $geoviewdata_service;
37
+	private ?GeoDispersionModule $module;
38
+	private GeoAnalysisViewDataService $geoviewdata_service;
39 39
 
40
-    /**
41
-     * Constructor for GeoAnalysisViewPage Request Handler
42
-     *
43
-     * @param ModuleService $module_service
44
-     */
45
-    public function __construct(
46
-        ModuleService $module_service,
47
-        GeoAnalysisViewDataService $geoviewdata_service
48
-    ) {
49
-        $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
50
-        $this->geoviewdata_service = $geoviewdata_service;
51
-    }
40
+	/**
41
+	 * Constructor for GeoAnalysisViewPage Request Handler
42
+	 *
43
+	 * @param ModuleService $module_service
44
+	 */
45
+	public function __construct(
46
+		ModuleService $module_service,
47
+		GeoAnalysisViewDataService $geoviewdata_service
48
+	) {
49
+		$this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
50
+		$this->geoviewdata_service = $geoviewdata_service;
51
+	}
52 52
 
53
-    /**
54
-     * {@inheritDoc}
55
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
56
-     */
57
-    public function handle(ServerRequestInterface $request): ResponseInterface
58
-    {
59
-        if ($this->module === null) {
60
-            throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
61
-        }
53
+	/**
54
+	 * {@inheritDoc}
55
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
56
+	 */
57
+	public function handle(ServerRequestInterface $request): ResponseInterface
58
+	{
59
+		if ($this->module === null) {
60
+			throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
61
+		}
62 62
 
63
-        $tree = Validator::attributes($request)->tree();
64
-        $view_id = Validator::attributes($request)->integer('view_id', 0);
63
+		$tree = Validator::attributes($request)->tree();
64
+		$view_id = Validator::attributes($request)->integer('view_id', 0);
65 65
 
66
-        return $this->viewResponse($this->module->name() . '::geoanalysisview-page', [
67
-            'module_name'           =>  $this->module->name(),
68
-            'title'                 =>  I18N::translate('Geographical dispersion'),
69
-            'tree'                  =>  $tree,
70
-            'view'                  =>  $this->geoviewdata_service->find($tree, $view_id)
71
-        ]);
72
-    }
66
+		return $this->viewResponse($this->module->name() . '::geoanalysisview-page', [
67
+			'module_name'           =>  $this->module->name(),
68
+			'title'                 =>  I18N::translate('Geographical dispersion'),
69
+			'tree'                  =>  $tree,
70
+			'view'                  =>  $this->geoviewdata_service->find($tree, $view_id)
71
+		]);
72
+	}
73 73
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
         $tree = Validator::attributes($request)->tree();
64 64
         $view_id = Validator::attributes($request)->integer('view_id', 0);
65 65
 
66
-        return $this->viewResponse($this->module->name() . '::geoanalysisview-page', [
66
+        return $this->viewResponse($this->module->name().'::geoanalysisview-page', [
67 67
             'module_name'           =>  $this->module->name(),
68 68
             'title'                 =>  I18N::translate('Geographical dispersion'),
69 69
             'tree'                  =>  $tree,
Please login to merge, or discard this patch.
app/Module/GeoDispersion/Http/RequestHandlers/GeoAnalysisViewTabs.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -31,58 +31,58 @@
 block discarded – undo
31 31
  */
32 32
 class GeoAnalysisViewTabs implements RequestHandlerInterface
33 33
 {
34
-    private ?GeoDispersionModule $module;
35
-    private GeoAnalysisViewDataService $geoviewdata_service;
34
+	private ?GeoDispersionModule $module;
35
+	private GeoAnalysisViewDataService $geoviewdata_service;
36 36
 
37
-    /**
38
-     * Constructor for GeoAnalysisMapsList Request Handler
39
-     *
40
-     * @param ModuleService $module_service
41
-     */
42
-    public function __construct(
43
-        ModuleService $module_service,
44
-        GeoAnalysisViewDataService $geoviewdata_service
45
-    ) {
46
-        $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
47
-        $this->geoviewdata_service = $geoviewdata_service;
48
-    }
37
+	/**
38
+	 * Constructor for GeoAnalysisMapsList Request Handler
39
+	 *
40
+	 * @param ModuleService $module_service
41
+	 */
42
+	public function __construct(
43
+		ModuleService $module_service,
44
+		GeoAnalysisViewDataService $geoviewdata_service
45
+	) {
46
+		$this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
47
+		$this->geoviewdata_service = $geoviewdata_service;
48
+	}
49 49
 
50
-    /**
51
-     * {@inheritDoc}
52
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
53
-     */
54
-    public function handle(ServerRequestInterface $request): ResponseInterface
55
-    {
56
-        if ($this->module === null) {
57
-            throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
58
-        }
50
+	/**
51
+	 * {@inheritDoc}
52
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
53
+	 */
54
+	public function handle(ServerRequestInterface $request): ResponseInterface
55
+	{
56
+		if ($this->module === null) {
57
+			throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
58
+		}
59 59
 
60
-        $tree = Validator::attributes($request)->tree();
61
-        $view_id = Validator::attributes($request)->integer('view_id', -1);
60
+		$tree = Validator::attributes($request)->tree();
61
+		$view_id = Validator::attributes($request)->integer('view_id', -1);
62 62
 
63
-        $view = $this->geoviewdata_service->find($tree, $view_id);
63
+		$view = $this->geoviewdata_service->find($tree, $view_id);
64 64
 
65
-        if ($view === null) {
66
-            throw new HttpNotFoundException(I18N::translate('The requested dispersion analysis does not exist.'));
67
-        }
65
+		if ($view === null) {
66
+			throw new HttpNotFoundException(I18N::translate('The requested dispersion analysis does not exist.'));
67
+		}
68 68
 
69
-        $results = $view->analysis()->results($tree, $view->placesDepth());
69
+		$results = $view->analysis()->results($tree, $view->placesDepth());
70 70
 
71
-        $params = [
72
-            'module_name'   =>  $this->module->name(),
73
-            'tree'          =>  $tree,
74
-            'view'          =>  $view,
75
-            'items_descr'   =>  $view->analysis()->itemsDescription()
76
-        ];
77
-        $response = [
78
-            'global'    =>  view('layouts/ajax', [
79
-                'content' =>    $view->globalTabContent($this->module, $results->global(), $params)
80
-            ]),
81
-            'detailed'  => view('layouts/ajax', [
82
-                'content' =>    $view->detailedTabContent($this->module, $results->sortedDetailed(), $params)
83
-            ])
84
-        ];
71
+		$params = [
72
+			'module_name'   =>  $this->module->name(),
73
+			'tree'          =>  $tree,
74
+			'view'          =>  $view,
75
+			'items_descr'   =>  $view->analysis()->itemsDescription()
76
+		];
77
+		$response = [
78
+			'global'    =>  view('layouts/ajax', [
79
+				'content' =>    $view->globalTabContent($this->module, $results->global(), $params)
80
+			]),
81
+			'detailed'  => view('layouts/ajax', [
82
+				'content' =>    $view->detailedTabContent($this->module, $results->sortedDetailed(), $params)
83
+			])
84
+		];
85 85
 
86
-        return response($response);
87
-    }
86
+		return response($response);
87
+	}
88 88
 }
Please login to merge, or discard this patch.
Module/GeoDispersion/Http/RequestHandlers/GeoAnalysisViewStatusAction.php 2 patches
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -32,67 +32,67 @@
 block discarded – undo
32 32
  */
33 33
 class GeoAnalysisViewStatusAction implements RequestHandlerInterface
34 34
 {
35
-    private ?GeoDispersionModule $module;
36
-    private GeoAnalysisViewDataService $geoview_data_service;
35
+	private ?GeoDispersionModule $module;
36
+	private GeoAnalysisViewDataService $geoview_data_service;
37 37
 
38
-    /**
39
-     * Constructor for GeoAnalysisViewStatusAction Request Handler
40
-     *
41
-     * @param ModuleService $module_service
42
-     * @param GeoAnalysisViewDataService $geoview_data_service
43
-     */
44
-    public function __construct(ModuleService $module_service, GeoAnalysisViewDataService $geoview_data_service)
45
-    {
46
-        $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
47
-        $this->geoview_data_service = $geoview_data_service;
48
-    }
38
+	/**
39
+	 * Constructor for GeoAnalysisViewStatusAction Request Handler
40
+	 *
41
+	 * @param ModuleService $module_service
42
+	 * @param GeoAnalysisViewDataService $geoview_data_service
43
+	 */
44
+	public function __construct(ModuleService $module_service, GeoAnalysisViewDataService $geoview_data_service)
45
+	{
46
+		$this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
47
+		$this->geoview_data_service = $geoview_data_service;
48
+	}
49 49
 
50
-    /**
51
-     * {@inheritDoc}
52
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
53
-     */
54
-    public function handle(ServerRequestInterface $request): ResponseInterface
55
-    {
56
-        $tree = Validator::attributes($request)->tree();
50
+	/**
51
+	 * {@inheritDoc}
52
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
53
+	 */
54
+	public function handle(ServerRequestInterface $request): ResponseInterface
55
+	{
56
+		$tree = Validator::attributes($request)->tree();
57 57
 
58
-        $admin_config_route = route(AdminConfigPage::class, ['tree' => $tree->name()]);
58
+		$admin_config_route = route(AdminConfigPage::class, ['tree' => $tree->name()]);
59 59
 
60
-        if ($this->module === null) {
61
-            FlashMessages::addMessage(
62
-                I18N::translate('The attached module could not be found.'),
63
-                'danger'
64
-            );
65
-            return redirect($admin_config_route);
66
-        }
60
+		if ($this->module === null) {
61
+			FlashMessages::addMessage(
62
+				I18N::translate('The attached module could not be found.'),
63
+				'danger'
64
+			);
65
+			return redirect($admin_config_route);
66
+		}
67 67
 
68
-        $view_id = Validator::attributes($request)->integer('view_id', -1);
69
-        $view = $this->geoview_data_service->find($tree, $view_id, true);
68
+		$view_id = Validator::attributes($request)->integer('view_id', -1);
69
+		$view = $this->geoview_data_service->find($tree, $view_id, true);
70 70
 
71
-        if ($view === null) {
72
-            FlashMessages::addMessage(
73
-                I18N::translate('The view with ID “%s” does not exist.', I18N::number($view_id)),
74
-                'danger'
75
-            );
76
-            return redirect($admin_config_route);
77
-        }
71
+		if ($view === null) {
72
+			FlashMessages::addMessage(
73
+				I18N::translate('The view with ID “%s” does not exist.', I18N::number($view_id)),
74
+				'danger'
75
+			);
76
+			return redirect($admin_config_route);
77
+		}
78 78
 
79
-        try {
80
-            $this->geoview_data_service->updateStatus($view, Validator::attributes($request)->boolean('enable', false));
81
-            FlashMessages::addMessage(
82
-                I18N::translate('The geographical dispersion analysis view has been successfully updated.'),
83
-                'success'
84
-            );
85
-            //phpcs:ignore Generic.Files.LineLength.TooLong
86
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been updated.');
87
-        } catch (Throwable $ex) {
88
-            FlashMessages::addMessage(
89
-                I18N::translate('An error occured while updating the geographical dispersion analysis view.'),
90
-                'danger'
91
-            );
92
-            //phpcs:ignore Generic.Files.LineLength.TooLong
93
-            Log::addErrorLog('Module ' . $this->module->title() . ' : Error when updating view “' . $view->id() . '”: ' . $ex->getMessage());
94
-        }
79
+		try {
80
+			$this->geoview_data_service->updateStatus($view, Validator::attributes($request)->boolean('enable', false));
81
+			FlashMessages::addMessage(
82
+				I18N::translate('The geographical dispersion analysis view has been successfully updated.'),
83
+				'success'
84
+			);
85
+			//phpcs:ignore Generic.Files.LineLength.TooLong
86
+			Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been updated.');
87
+		} catch (Throwable $ex) {
88
+			FlashMessages::addMessage(
89
+				I18N::translate('An error occured while updating the geographical dispersion analysis view.'),
90
+				'danger'
91
+			);
92
+			//phpcs:ignore Generic.Files.LineLength.TooLong
93
+			Log::addErrorLog('Module ' . $this->module->title() . ' : Error when updating view “' . $view->id() . '”: ' . $ex->getMessage());
94
+		}
95 95
 
96
-        return redirect($admin_config_route);
97
-    }
96
+		return redirect($admin_config_route);
97
+	}
98 98
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -104,14 +104,14 @@
 block discarded – undo
104 104
                 'success'
105 105
             );
106 106
             //phpcs:ignore Generic.Files.LineLength.TooLong
107
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been updated.');
107
+            Log::addConfigurationLog('Module '.$this->module->title().' : View “'.$view->id().'” has been updated.');
108 108
         } catch (Throwable $ex) {
109 109
             FlashMessages::addMessage(
110 110
                 I18N::translate('An error occured while updating the geographical dispersion analysis view.'),
111 111
                 'danger'
112 112
             );
113 113
             //phpcs:ignore Generic.Files.LineLength.TooLong
114
-            Log::addErrorLog('Module ' . $this->module->title() . ' : Error when updating view “' . $view->id() . '”: ' . $ex->getMessage());
114
+            Log::addErrorLog('Module '.$this->module->title().' : Error when updating view “'.$view->id().'”: '.$ex->getMessage());
115 115
         }
116 116
 
117 117
         return redirect($admin_config_route);
Please login to merge, or discard this patch.
app/Module/GeoDispersion/Http/RequestHandlers/GeoAnalysisViewEditPage.php 2 patches
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -32,64 +32,64 @@
 block discarded – undo
32 32
  */
33 33
 class GeoAnalysisViewEditPage implements RequestHandlerInterface
34 34
 {
35
-    use ViewResponseTrait;
35
+	use ViewResponseTrait;
36 36
 
37
-    private ?GeoDispersionModule $module;
38
-    private GeoAnalysisViewDataService $geoview_data_service;
39
-    private GeoAnalysisService $geoanalysis_service;
40
-    private GeoAnalysisDataService $geoanalysis_data_service;
37
+	private ?GeoDispersionModule $module;
38
+	private GeoAnalysisViewDataService $geoview_data_service;
39
+	private GeoAnalysisService $geoanalysis_service;
40
+	private GeoAnalysisDataService $geoanalysis_data_service;
41 41
 
42
-    /**
43
-     * Constructor for GeoAnalysisViewEditPage Request Handler
44
-     *
45
-     * @param ModuleService $module_service
46
-     * @param GeoAnalysisViewDataService $geoview_data_service
47
-     * @param GeoAnalysisService $geoanalysis_service
48
-     * @param GeoAnalysisDataService $geoanalysis_data_service
49
-     */
50
-    public function __construct(
51
-        ModuleService $module_service,
52
-        GeoAnalysisViewDataService $geoview_data_service,
53
-        GeoAnalysisService $geoanalysis_service,
54
-        GeoAnalysisDataService $geoanalysis_data_service
55
-    ) {
56
-        $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
57
-        $this->geoview_data_service = $geoview_data_service;
58
-        $this->geoanalysis_service = $geoanalysis_service;
59
-        $this->geoanalysis_data_service = $geoanalysis_data_service;
60
-    }
42
+	/**
43
+	 * Constructor for GeoAnalysisViewEditPage Request Handler
44
+	 *
45
+	 * @param ModuleService $module_service
46
+	 * @param GeoAnalysisViewDataService $geoview_data_service
47
+	 * @param GeoAnalysisService $geoanalysis_service
48
+	 * @param GeoAnalysisDataService $geoanalysis_data_service
49
+	 */
50
+	public function __construct(
51
+		ModuleService $module_service,
52
+		GeoAnalysisViewDataService $geoview_data_service,
53
+		GeoAnalysisService $geoanalysis_service,
54
+		GeoAnalysisDataService $geoanalysis_data_service
55
+	) {
56
+		$this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
57
+		$this->geoview_data_service = $geoview_data_service;
58
+		$this->geoanalysis_service = $geoanalysis_service;
59
+		$this->geoanalysis_data_service = $geoanalysis_data_service;
60
+	}
61 61
 
62
-    /**
63
-     * {@inheritDoc}
64
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
65
-     */
66
-    public function handle(ServerRequestInterface $request): ResponseInterface
67
-    {
68
-        $this->layout = 'layouts/administration';
62
+	/**
63
+	 * {@inheritDoc}
64
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
65
+	 */
66
+	public function handle(ServerRequestInterface $request): ResponseInterface
67
+	{
68
+		$this->layout = 'layouts/administration';
69 69
 
70
-        if ($this->module === null) {
71
-            throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
72
-        }
70
+		if ($this->module === null) {
71
+			throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
72
+		}
73 73
 
74
-        $tree = Validator::attributes($request)->tree();
74
+		$tree = Validator::attributes($request)->tree();
75 75
 
76
-        $view_id = Validator::attributes($request)->integer('view_id', -1);
77
-        $view = $this->geoview_data_service->find($tree, $view_id, true);
76
+		$view_id = Validator::attributes($request)->integer('view_id', -1);
77
+		$view = $this->geoview_data_service->find($tree, $view_id, true);
78 78
 
79
-        if ($view === null) {
80
-            throw new HttpNotFoundException(
81
-                I18N::translate('The geographical dispersion analysis view could not be found.')
82
-            );
83
-        }
79
+		if ($view === null) {
80
+			throw new HttpNotFoundException(
81
+				I18N::translate('The geographical dispersion analysis view could not be found.')
82
+			);
83
+		}
84 84
 
85
-        return $this->viewResponse($this->module->name() . '::admin/view-edit', [
86
-            'module'        =>  $this->module,
87
-            'title'         =>  I18N::translate('Edit the geographical dispersion analysis view - %s', $view->type()),
88
-            'tree'          =>  $tree,
89
-            'view'          =>  $view,
90
-            'geoanalysis_list'  =>  $this->geoanalysis_service->all(),
91
-            'place_example'     =>  $this->geoanalysis_data_service->placeHierarchyExample($tree),
92
-            'global_settings'   =>  $view->globalSettingsContent($this->module)
93
-        ]);
94
-    }
85
+		return $this->viewResponse($this->module->name() . '::admin/view-edit', [
86
+			'module'        =>  $this->module,
87
+			'title'         =>  I18N::translate('Edit the geographical dispersion analysis view - %s', $view->type()),
88
+			'tree'          =>  $tree,
89
+			'view'          =>  $view,
90
+			'geoanalysis_list'  =>  $this->geoanalysis_service->all(),
91
+			'place_example'     =>  $this->geoanalysis_data_service->placeHierarchyExample($tree),
92
+			'global_settings'   =>  $view->globalSettingsContent($this->module)
93
+		]);
94
+	}
95 95
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@
 block discarded – undo
82 82
             );
83 83
         }
84 84
 
85
-        return $this->viewResponse($this->module->name() . '::admin/view-edit', [
85
+        return $this->viewResponse($this->module->name().'::admin/view-edit', [
86 86
             'module'        =>  $this->module,
87 87
             'title'         =>  I18N::translate('Edit the geographical dispersion analysis view - %s', $view->type()),
88 88
             'tree'          =>  $tree,
Please login to merge, or discard this patch.
Module/GeoDispersion/PlaceMappers/Config/FilteredTopPlaceMapperConfig.php 2 patches
Indentation   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -29,111 +29,111 @@
 block discarded – undo
29 29
  */
30 30
 class FilteredTopPlaceMapperConfig extends GenericPlaceMapperConfig
31 31
 {
32
-    private TreeService $tree_service;
32
+	private TreeService $tree_service;
33 33
 
34
-    /**
35
-     * FilteredTopPlaceMapperConfig
36
-     *
37
-     * @param TreeService $tree_service
38
-     */
39
-    public function __construct(TreeService $tree_service)
40
-    {
41
-        $this->tree_service = $tree_service;
42
-    }
34
+	/**
35
+	 * FilteredTopPlaceMapperConfig
36
+	 *
37
+	 * @param TreeService $tree_service
38
+	 */
39
+	public function __construct(TreeService $tree_service)
40
+	{
41
+		$this->tree_service = $tree_service;
42
+	}
43 43
 
44
-    /**
45
-     * Get the configured Top Places to filter on
46
-     *
47
-     * @return Collection<Place>
48
-     */
49
-    public function topPlaces(): Collection
50
-    {
51
-        return collect($this->get('topPlaces', []))
52
-            ->filter(
53
-                /** @psalm-suppress MissingClosureParamType */
54
-                fn($item): bool => $item instanceof Place
55
-            );
56
-    }
44
+	/**
45
+	 * Get the configured Top Places to filter on
46
+	 *
47
+	 * @return Collection<Place>
48
+	 */
49
+	public function topPlaces(): Collection
50
+	{
51
+		return collect($this->get('topPlaces', []))
52
+			->filter(
53
+				/** @psalm-suppress MissingClosureParamType */
54
+				fn($item): bool => $item instanceof Place
55
+			);
56
+	}
57 57
 
58
-    /**
59
-     * {@inheritDoc}
60
-     * @see \MyArtJaub\Webtrees\Common\GeoDispersion\Config\GenericPlaceMapperConfig::jsonSerializeConfig()
61
-     */
62
-    public function jsonSerializeConfig()
63
-    {
64
-        return [
65
-            'topPlaces' => $this->topPlaces()
66
-                ->map(fn(Place $place): array => [ $place->tree()->id(), $place->gedcomName() ])
67
-                ->toArray()
68
-        ];
69
-    }
58
+	/**
59
+	 * {@inheritDoc}
60
+	 * @see \MyArtJaub\Webtrees\Common\GeoDispersion\Config\GenericPlaceMapperConfig::jsonSerializeConfig()
61
+	 */
62
+	public function jsonSerializeConfig()
63
+	{
64
+		return [
65
+			'topPlaces' => $this->topPlaces()
66
+				->map(fn(Place $place): array => [ $place->tree()->id(), $place->gedcomName() ])
67
+				->toArray()
68
+		];
69
+	}
70 70
 
71
-    /**
72
-     * {@inheritDoc}
73
-     * @see \MyArtJaub\Webtrees\Common\GeoDispersion\Config\GenericPlaceMapperConfig::jsonDeserialize()
74
-     *
75
-     * @param mixed $config
76
-     * @return $this
77
-     */
78
-    public function jsonDeserialize($config): self
79
-    {
80
-        if (is_string($config)) {
81
-            return $this->jsonDeserialize(json_decode($config));
82
-        }
83
-        if (is_array($config)) {
84
-            $this->setConfig([
85
-                'topPlaces' => collect($config['topPlaces'] ?? [])
86
-                    ->filter(
87
-                        /** @psalm-suppress MissingClosureParamType */
88
-                        fn($item): bool => is_array($item) && count($item) == 2
89
-                    )->map(function (array $item): ?Place {
90
-                        try {
91
-                            return new Place($item[1], $this->tree_service->find($item[0]));
92
-                        } catch (RuntimeException $ex) {
93
-                            return null;
94
-                        }
95
-                    })
96
-                    ->filter()
97
-                    ->toArray()
98
-                ]);
99
-        }
100
-        return $this;
101
-    }
71
+	/**
72
+	 * {@inheritDoc}
73
+	 * @see \MyArtJaub\Webtrees\Common\GeoDispersion\Config\GenericPlaceMapperConfig::jsonDeserialize()
74
+	 *
75
+	 * @param mixed $config
76
+	 * @return $this
77
+	 */
78
+	public function jsonDeserialize($config): self
79
+	{
80
+		if (is_string($config)) {
81
+			return $this->jsonDeserialize(json_decode($config));
82
+		}
83
+		if (is_array($config)) {
84
+			$this->setConfig([
85
+				'topPlaces' => collect($config['topPlaces'] ?? [])
86
+					->filter(
87
+						/** @psalm-suppress MissingClosureParamType */
88
+						fn($item): bool => is_array($item) && count($item) == 2
89
+					)->map(function (array $item): ?Place {
90
+						try {
91
+							return new Place($item[1], $this->tree_service->find($item[0]));
92
+						} catch (RuntimeException $ex) {
93
+							return null;
94
+						}
95
+					})
96
+					->filter()
97
+					->toArray()
98
+				]);
99
+		}
100
+		return $this;
101
+	}
102 102
 
103
-    /**
104
-     * {@inheritDoc}
105
-     * @see \MyArtJaub\Webtrees\Common\GeoDispersion\Config\GenericPlaceMapperConfig::configContent()
106
-     */
107
-    public function configContent(ModuleInterface $module, Tree $tree): string
108
-    {
109
-        return view($module->name() . '::mappers/filtered-top-config', [
110
-            'tree'          =>  $tree,
111
-            'top_places'    =>  $this->topPlaces()
112
-        ]);
113
-    }
103
+	/**
104
+	 * {@inheritDoc}
105
+	 * @see \MyArtJaub\Webtrees\Common\GeoDispersion\Config\GenericPlaceMapperConfig::configContent()
106
+	 */
107
+	public function configContent(ModuleInterface $module, Tree $tree): string
108
+	{
109
+		return view($module->name() . '::mappers/filtered-top-config', [
110
+			'tree'          =>  $tree,
111
+			'top_places'    =>  $this->topPlaces()
112
+		]);
113
+	}
114 114
 
115
-    /**
116
-     * {@inheritDoc}
117
-     * @see \MyArtJaub\Webtrees\Common\GeoDispersion\Config\GenericPlaceMapperConfig::withConfigUpdate()
118
-     * @return $this
119
-     */
120
-    public function withConfigUpdate(ServerRequestInterface $request): self
121
-    {
122
-        $tree = Validator::attributes($request)->treeOptional();
115
+	/**
116
+	 * {@inheritDoc}
117
+	 * @see \MyArtJaub\Webtrees\Common\GeoDispersion\Config\GenericPlaceMapperConfig::withConfigUpdate()
118
+	 * @return $this
119
+	 */
120
+	public function withConfigUpdate(ServerRequestInterface $request): self
121
+	{
122
+		$tree = Validator::attributes($request)->treeOptional();
123 123
 
124
-        if ($tree === null) {
125
-            return $this;
126
-        }
124
+		if ($tree === null) {
125
+			return $this;
126
+		}
127 127
 
128
-        $top_places = Validator::parsedBody($request)->array('mapper_filt_top_places');
129
-        $config = ['topPlaces' => []];
130
-        foreach ($top_places as $top_place_id) {
131
-            $place = Place::find((int) $top_place_id, $tree);
132
-            if (mb_strlen($place->gedcomName()) > 0) {
133
-                $config['topPlaces'][] = $place;
134
-            }
135
-        }
136
-        $this->setConfig($config);
137
-        return $this;
138
-    }
128
+		$top_places = Validator::parsedBody($request)->array('mapper_filt_top_places');
129
+		$config = ['topPlaces' => []];
130
+		foreach ($top_places as $top_place_id) {
131
+			$place = Place::find((int) $top_place_id, $tree);
132
+			if (mb_strlen($place->gedcomName()) > 0) {
133
+				$config['topPlaces'][] = $place;
134
+			}
135
+		}
136
+		$this->setConfig($config);
137
+		return $this;
138
+	}
139 139
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     {
64 64
         return [
65 65
             'topPlaces' => $this->topPlaces()
66
-                ->map(fn(Place $place): array => [ $place->tree()->id(), $place->gedcomName() ])
66
+                ->map(fn(Place $place): array => [$place->tree()->id(), $place->gedcomName()])
67 67
                 ->toArray()
68 68
         ];
69 69
     }
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
                     ->filter(
87 87
                         /** @psalm-suppress MissingClosureParamType */
88 88
                         fn($item): bool => is_array($item) && count($item) == 2
89
-                    )->map(function (array $item): ?Place {
89
+                    )->map(function(array $item): ?Place {
90 90
                         try {
91 91
                             return new Place($item[1], $this->tree_service->find($item[0]));
92 92
                         } catch (RuntimeException $ex) {
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
      */
107 107
     public function configContent(ModuleInterface $module, Tree $tree): string
108 108
     {
109
-        return view($module->name() . '::mappers/filtered-top-config', [
109
+        return view($module->name().'::mappers/filtered-top-config', [
110 110
             'tree'          =>  $tree,
111 111
             'top_places'    =>  $this->topPlaces()
112 112
         ]);
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
         $top_places = Validator::parsedBody($request)->array('mapper_filt_top_places');
129 129
         $config = ['topPlaces' => []];
130 130
         foreach ($top_places as $top_place_id) {
131
-            $place = Place::find((int) $top_place_id, $tree);
131
+            $place = Place::find((int)$top_place_id, $tree);
132 132
             if (mb_strlen($place->gedcomName()) > 0) {
133 133
                 $config['topPlaces'][] = $place;
134 134
             }
Please login to merge, or discard this patch.
app/Module/GeoDispersion/PlaceMappers/TopFilteredPlaceMapperTrait.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -21,51 +21,51 @@
 block discarded – undo
21 21
  */
22 22
 trait TopFilteredPlaceMapperTrait
23 23
 {
24
-    /**
25
-     * @var Place[] $top_places
26
-     */
27
-    private array $top_places = [];
24
+	/**
25
+	 * @var Place[] $top_places
26
+	 */
27
+	private array $top_places = [];
28 28
 
29
-    /**
30
-     * Get the list of top level places.
31
-     *
32
-     * @return Place[]
33
-     */
34
-    public function topPlaces(): array
35
-    {
36
-        return $this->top_places;
37
-    }
29
+	/**
30
+	 * Get the list of top level places.
31
+	 *
32
+	 * @return Place[]
33
+	 */
34
+	public function topPlaces(): array
35
+	{
36
+		return $this->top_places;
37
+	}
38 38
 
39
-    /**
40
-     * Set the list of defined top level places.
41
-     *
42
-     * @param Place[] $top_places
43
-     */
44
-    public function setTopPlaces(array $top_places): void
45
-    {
46
-        $this->top_places = collect($top_places)
47
-            ->filter(
48
-                /** @psalm-suppress MissingClosureParamType */
49
-                fn($top_places): bool => $top_places instanceof Place
50
-            )->toArray();
51
-    }
39
+	/**
40
+	 * Set the list of defined top level places.
41
+	 *
42
+	 * @param Place[] $top_places
43
+	 */
44
+	public function setTopPlaces(array $top_places): void
45
+	{
46
+		$this->top_places = collect($top_places)
47
+			->filter(
48
+				/** @psalm-suppress MissingClosureParamType */
49
+				fn($top_places): bool => $top_places instanceof Place
50
+			)->toArray();
51
+	}
52 52
 
53
-    /**
54
-     * Check whether a Place belongs to one of the defined top places.
55
-     *
56
-     * @param Place $place
57
-     * @return bool
58
-     */
59
-    protected function belongsToTopLevels(Place $place): bool
60
-    {
61
-        foreach ($this->top_places as $top_place) {
62
-            if (
63
-                $top_place->tree()->id() === $place->tree()->id() &&
64
-                str_ends_with($place->gedcomName(), $top_place->gedcomName())
65
-            ) {
66
-                    return true;
67
-            }
68
-        }
69
-        return false;
70
-    }
53
+	/**
54
+	 * Check whether a Place belongs to one of the defined top places.
55
+	 *
56
+	 * @param Place $place
57
+	 * @return bool
58
+	 */
59
+	protected function belongsToTopLevels(Place $place): bool
60
+	{
61
+		foreach ($this->top_places as $top_place) {
62
+			if (
63
+				$top_place->tree()->id() === $place->tree()->id() &&
64
+				str_ends_with($place->gedcomName(), $top_place->gedcomName())
65
+			) {
66
+					return true;
67
+			}
68
+		}
69
+		return false;
70
+	}
71 71
 }
Please login to merge, or discard this patch.