Passed
Push — feature/code-analysis ( 00c5b4...e321b8 )
by Jonathan
13:27
created
app/Module/AdminTasks/Http/RequestHandlers/TaskStatusAction.php 1 patch
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -32,66 +32,66 @@
 block discarded – undo
32 32
  */
33 33
 class TaskStatusAction implements RequestHandlerInterface
34 34
 {
35
-    private ?AdminTasksModule $module;
36
-    private TaskScheduleService $taskschedules_service;
35
+	private ?AdminTasksModule $module;
36
+	private TaskScheduleService $taskschedules_service;
37 37
 
38
-    /**
39
-     * Constructor for TaskStatusAction Request Handler
40
-     *
41
-     * @param ModuleService $module_service
42
-     * @param TaskScheduleService $taskschedules_service
43
-     */
44
-    public function __construct(ModuleService $module_service, TaskScheduleService $taskschedules_service)
45
-    {
46
-        $this->module = $module_service->findByInterface(AdminTasksModule::class)->first();
47
-        $this->taskschedules_service = $taskschedules_service;
48
-    }
38
+	/**
39
+	 * Constructor for TaskStatusAction Request Handler
40
+	 *
41
+	 * @param ModuleService $module_service
42
+	 * @param TaskScheduleService $taskschedules_service
43
+	 */
44
+	public function __construct(ModuleService $module_service, TaskScheduleService $taskschedules_service)
45
+	{
46
+		$this->module = $module_service->findByInterface(AdminTasksModule::class)->first();
47
+		$this->taskschedules_service = $taskschedules_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
-            FlashMessages::addMessage(
58
-                I18N::translate('The attached module could not be found.'),
59
-                'danger'
60
-            );
61
-            return Registry::responseFactory()->redirect(HomePage::class);
62
-        }
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
+			FlashMessages::addMessage(
58
+				I18N::translate('The attached module could not be found.'),
59
+				'danger'
60
+			);
61
+			return Registry::responseFactory()->redirect(HomePage::class);
62
+		}
63 63
 
64
-        $task_sched_id = Validator::attributes($request)->integer('task', -1);
65
-        $task_schedule = $this->taskschedules_service->find($task_sched_id);
64
+		$task_sched_id = Validator::attributes($request)->integer('task', -1);
65
+		$task_schedule = $this->taskschedules_service->find($task_sched_id);
66 66
 
67
-        if ($task_schedule === null) {
68
-            FlashMessages::addMessage(
69
-                I18N::translate('The task shedule with ID “%s” does not exist.', I18N::number($task_sched_id)),
70
-                'danger'
71
-            );
72
-            return Registry::responseFactory()->redirect(AdminConfigPage::class);
73
-        }
67
+		if ($task_schedule === null) {
68
+			FlashMessages::addMessage(
69
+				I18N::translate('The task shedule with ID “%s” does not exist.', I18N::number($task_sched_id)),
70
+				'danger'
71
+			);
72
+			return Registry::responseFactory()->redirect(AdminConfigPage::class);
73
+		}
74 74
 
75
-        Validator::attributes($request)->boolean('enable', false) ?
76
-            $task_schedule->enable() :
77
-            $task_schedule->disable();
75
+		Validator::attributes($request)->boolean('enable', false) ?
76
+			$task_schedule->enable() :
77
+			$task_schedule->disable();
78 78
 
79
-        if ($this->taskschedules_service->update($task_schedule) > 0) {
80
-            FlashMessages::addMessage(
81
-                I18N::translate('The scheduled task has been successfully updated.'),
82
-                'success'
83
-            );
84
-            //phpcs:ignore Generic.Files.LineLength.TooLong
85
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Task Schedule “' . $task_schedule->id() . '” has been updated.');
86
-        } else {
87
-            FlashMessages::addMessage(
88
-                I18N::translate('An error occured while updating the scheduled task.'),
89
-                'danger'
90
-            );
91
-            //phpcs:ignore Generic.Files.LineLength.TooLong
92
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Task Schedule “' . $task_schedule->id() . '” could not be updated. See error log.');
93
-        }
79
+		if ($this->taskschedules_service->update($task_schedule) > 0) {
80
+			FlashMessages::addMessage(
81
+				I18N::translate('The scheduled task has been successfully updated.'),
82
+				'success'
83
+			);
84
+			//phpcs:ignore Generic.Files.LineLength.TooLong
85
+			Log::addConfigurationLog('Module ' . $this->module->title() . ' : Task Schedule “' . $task_schedule->id() . '” has been updated.');
86
+		} else {
87
+			FlashMessages::addMessage(
88
+				I18N::translate('An error occured while updating the scheduled task.'),
89
+				'danger'
90
+			);
91
+			//phpcs:ignore Generic.Files.LineLength.TooLong
92
+			Log::addConfigurationLog('Module ' . $this->module->title() . ' : Task Schedule “' . $task_schedule->id() . '” could not be updated. See error log.');
93
+		}
94 94
 
95
-        return Registry::responseFactory()->redirect(AdminConfigPage::class);
96
-    }
95
+		return Registry::responseFactory()->redirect(AdminConfigPage::class);
96
+	}
97 97
 }
Please login to merge, or discard this patch.
app/Module/AdminTasks/Http/RequestHandlers/TaskEditAction.php 1 patch
Indentation   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -35,146 +35,146 @@
 block discarded – undo
35 35
  */
36 36
 class TaskEditAction implements RequestHandlerInterface
37 37
 {
38
-    private ?AdminTasksModule $module;
39
-    private TaskScheduleService $taskschedules_service;
40
-
41
-    /**
42
-     * Constructor for TaskEditAction Request Handler
43
-     *
44
-     * @param ModuleService $module_service
45
-     * @param TaskScheduleService $taskschedules_service
46
-     */
47
-    public function __construct(ModuleService $module_service, TaskScheduleService $taskschedules_service)
48
-    {
49
-        $this->module = $module_service->findByInterface(AdminTasksModule::class)->first();
50
-        $this->taskschedules_service = $taskschedules_service;
51
-    }
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
-            FlashMessages::addMessage(
61
-                I18N::translate('The attached module could not be found.'),
62
-                'danger'
63
-            );
64
-            return Registry::responseFactory()->redirect(HomePage::class);
65
-        }
66
-
67
-        $task_sched_id = Validator::attributes($request)->integer('task', -1);
68
-        $task_schedule = $this->taskschedules_service->find($task_sched_id);
69
-
70
-        if ($task_schedule === null) {
71
-            FlashMessages::addMessage(
72
-                I18N::translate('The task shedule with ID “%s” does not exist.', I18N::number($task_sched_id)),
73
-                'danger'
74
-            );
75
-            return Registry::responseFactory()->redirect(AdminConfigPage::class);
76
-        }
77
-
78
-        $success = $this->updateGeneralSettings($task_schedule, $request);
79
-        $success = $success && $this->updateSpecificSettings($task_schedule, $request);
80
-
81
-        if ($success) {
82
-            FlashMessages::addMessage(
83
-                I18N::translate('The scheduled task has been successfully updated.'),
84
-                'success'
85
-            );
86
-            //phpcs:ignore Generic.Files.LineLength.TooLong
87
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Task Schedule “' . $task_schedule->id() . '” has been updated.');
88
-        }
89
-
90
-        return Registry::responseFactory()->redirect(AdminConfigPage::class);
91
-    }
92
-
93
-    /**
94
-     * Update general settings for the task, based on the request parameters
95
-     *
96
-     * @param TaskSchedule $task_schedule
97
-     * @param ServerRequestInterface $request
98
-     * @return bool
99
-     */
100
-    private function updateGeneralSettings(TaskSchedule $task_schedule, ServerRequestInterface $request): bool
101
-    {
102
-        if ($this->module === null) {
103
-            return false;
104
-        }
105
-
106
-        $frequency = Validator::parsedBody($request)->integer('frequency', 0);
107
-        if ($frequency > 0) {
108
-            $task_schedule->setFrequency($frequency);
109
-        } else {
110
-            FlashMessages::addMessage(I18N::translate('The frequency is not in a valid format.'), 'danger');
111
-        }
112
-
113
-        $is_limited = Validator::parsedBody($request)->boolean('is_limited', false);
114
-        $nb_occur = Validator::parsedBody($request)->integer('nb_occur', 1);
115
-        if ($is_limited) {
116
-            if ($nb_occur > 0) {
117
-                $task_schedule->setRemainingOccurrences($nb_occur);
118
-            } else {
119
-                FlashMessages::addMessage(
120
-                    I18N::translate('The number of remaining occurrences is not in a valid format.'),
121
-                    'danger'
122
-                );
123
-            }
124
-        } else {
125
-            $task_schedule->setRemainingOccurrences(0);
126
-        }
127
-
128
-        try {
129
-            $this->taskschedules_service->update($task_schedule);
130
-            return true;
131
-        } catch (Throwable $ex) {
132
-            Log::addErrorLog(
133
-                sprintf(
134
-                    'Error while updating the Task Schedule "%s". Exception: %s',
135
-                    $task_schedule->id(),
136
-                    $ex->getMessage()
137
-                )
138
-            );
139
-        }
140
-
141
-        FlashMessages::addMessage(I18N::translate('An error occured while updating the scheduled task.'), 'danger');
142
-        //@phpcs:ignore Generic.Files.LineLength.TooLong
143
-        Log::addConfigurationLog('Module ' . $this->module->title() . ' : Task Schedule “' . $task_schedule->id() . '” could not be updated. See error log.');
144
-        return false;
145
-    }
146
-
147
-    /**
148
-     * Update general settings for the task, based on the request parameters
149
-     *
150
-     * @param TaskSchedule $task_schedule
151
-     * @param ServerRequestInterface $request
152
-     * @return bool
153
-     */
154
-    private function updateSpecificSettings(TaskSchedule $task_schedule, ServerRequestInterface $request): bool
155
-    {
156
-        if ($this->module === null) {
157
-            return false;
158
-        }
159
-
160
-        $task = $this->taskschedules_service->findTask($task_schedule->taskId());
161
-        if ($task === null || !($task instanceof ConfigurableTaskInterface)) {
162
-            return true;
163
-        }
164
-
165
-        /** @var \MyArtJaub\Webtrees\Contracts\Tasks\TaskInterface&\MyArtJaub\Webtrees\Contracts\Tasks\ConfigurableTaskInterface $task */
166
-        if (!$task->updateConfig($request, $task_schedule)) {
167
-            FlashMessages::addMessage(
168
-                I18N::translate(
169
-                    'An error occured while updating the specific settings of administrative task “%s”.',
170
-                    $task->name()
171
-                ),
172
-                'danger'
173
-            );
174
-            //phpcs:ignore Generic.Files.LineLength.TooLong
175
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : AdminTask “' . $task->name() . '” specific settings could not be updated. See error log.');
176
-        }
177
-
178
-        return true;
179
-    }
38
+	private ?AdminTasksModule $module;
39
+	private TaskScheduleService $taskschedules_service;
40
+
41
+	/**
42
+	 * Constructor for TaskEditAction Request Handler
43
+	 *
44
+	 * @param ModuleService $module_service
45
+	 * @param TaskScheduleService $taskschedules_service
46
+	 */
47
+	public function __construct(ModuleService $module_service, TaskScheduleService $taskschedules_service)
48
+	{
49
+		$this->module = $module_service->findByInterface(AdminTasksModule::class)->first();
50
+		$this->taskschedules_service = $taskschedules_service;
51
+	}
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
+			FlashMessages::addMessage(
61
+				I18N::translate('The attached module could not be found.'),
62
+				'danger'
63
+			);
64
+			return Registry::responseFactory()->redirect(HomePage::class);
65
+		}
66
+
67
+		$task_sched_id = Validator::attributes($request)->integer('task', -1);
68
+		$task_schedule = $this->taskschedules_service->find($task_sched_id);
69
+
70
+		if ($task_schedule === null) {
71
+			FlashMessages::addMessage(
72
+				I18N::translate('The task shedule with ID “%s” does not exist.', I18N::number($task_sched_id)),
73
+				'danger'
74
+			);
75
+			return Registry::responseFactory()->redirect(AdminConfigPage::class);
76
+		}
77
+
78
+		$success = $this->updateGeneralSettings($task_schedule, $request);
79
+		$success = $success && $this->updateSpecificSettings($task_schedule, $request);
80
+
81
+		if ($success) {
82
+			FlashMessages::addMessage(
83
+				I18N::translate('The scheduled task has been successfully updated.'),
84
+				'success'
85
+			);
86
+			//phpcs:ignore Generic.Files.LineLength.TooLong
87
+			Log::addConfigurationLog('Module ' . $this->module->title() . ' : Task Schedule “' . $task_schedule->id() . '” has been updated.');
88
+		}
89
+
90
+		return Registry::responseFactory()->redirect(AdminConfigPage::class);
91
+	}
92
+
93
+	/**
94
+	 * Update general settings for the task, based on the request parameters
95
+	 *
96
+	 * @param TaskSchedule $task_schedule
97
+	 * @param ServerRequestInterface $request
98
+	 * @return bool
99
+	 */
100
+	private function updateGeneralSettings(TaskSchedule $task_schedule, ServerRequestInterface $request): bool
101
+	{
102
+		if ($this->module === null) {
103
+			return false;
104
+		}
105
+
106
+		$frequency = Validator::parsedBody($request)->integer('frequency', 0);
107
+		if ($frequency > 0) {
108
+			$task_schedule->setFrequency($frequency);
109
+		} else {
110
+			FlashMessages::addMessage(I18N::translate('The frequency is not in a valid format.'), 'danger');
111
+		}
112
+
113
+		$is_limited = Validator::parsedBody($request)->boolean('is_limited', false);
114
+		$nb_occur = Validator::parsedBody($request)->integer('nb_occur', 1);
115
+		if ($is_limited) {
116
+			if ($nb_occur > 0) {
117
+				$task_schedule->setRemainingOccurrences($nb_occur);
118
+			} else {
119
+				FlashMessages::addMessage(
120
+					I18N::translate('The number of remaining occurrences is not in a valid format.'),
121
+					'danger'
122
+				);
123
+			}
124
+		} else {
125
+			$task_schedule->setRemainingOccurrences(0);
126
+		}
127
+
128
+		try {
129
+			$this->taskschedules_service->update($task_schedule);
130
+			return true;
131
+		} catch (Throwable $ex) {
132
+			Log::addErrorLog(
133
+				sprintf(
134
+					'Error while updating the Task Schedule "%s". Exception: %s',
135
+					$task_schedule->id(),
136
+					$ex->getMessage()
137
+				)
138
+			);
139
+		}
140
+
141
+		FlashMessages::addMessage(I18N::translate('An error occured while updating the scheduled task.'), 'danger');
142
+		//@phpcs:ignore Generic.Files.LineLength.TooLong
143
+		Log::addConfigurationLog('Module ' . $this->module->title() . ' : Task Schedule “' . $task_schedule->id() . '” could not be updated. See error log.');
144
+		return false;
145
+	}
146
+
147
+	/**
148
+	 * Update general settings for the task, based on the request parameters
149
+	 *
150
+	 * @param TaskSchedule $task_schedule
151
+	 * @param ServerRequestInterface $request
152
+	 * @return bool
153
+	 */
154
+	private function updateSpecificSettings(TaskSchedule $task_schedule, ServerRequestInterface $request): bool
155
+	{
156
+		if ($this->module === null) {
157
+			return false;
158
+		}
159
+
160
+		$task = $this->taskschedules_service->findTask($task_schedule->taskId());
161
+		if ($task === null || !($task instanceof ConfigurableTaskInterface)) {
162
+			return true;
163
+		}
164
+
165
+		/** @var \MyArtJaub\Webtrees\Contracts\Tasks\TaskInterface&\MyArtJaub\Webtrees\Contracts\Tasks\ConfigurableTaskInterface $task */
166
+		if (!$task->updateConfig($request, $task_schedule)) {
167
+			FlashMessages::addMessage(
168
+				I18N::translate(
169
+					'An error occured while updating the specific settings of administrative task “%s”.',
170
+					$task->name()
171
+				),
172
+				'danger'
173
+			);
174
+			//phpcs:ignore Generic.Files.LineLength.TooLong
175
+			Log::addConfigurationLog('Module ' . $this->module->title() . ' : AdminTask “' . $task->name() . '” specific settings could not be updated. See error log.');
176
+		}
177
+
178
+		return true;
179
+	}
180 180
 }
Please login to merge, or discard this patch.
app/Module/GeoDispersion/PlaceMappers/CoordinatesPlaceMapper.php 1 patch
Indentation   +180 added lines, -180 removed lines patch added patch discarded remove patch
@@ -36,184 +36,184 @@
 block discarded – undo
36 36
  */
37 37
 class CoordinatesPlaceMapper implements PlaceMapperInterface
38 38
 {
39
-    use PlaceMapperTrait;
40
-
41
-    private ?GeometryEngine $geometry_engine = null;
42
-
43
-    /**
44
-     * {@inheritDoc}
45
-     * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::title()
46
-     */
47
-    public function title(): string
48
-    {
49
-        return I18N::translate('Mapping on place coordinates');
50
-    }
51
-
52
-    /**
53
-     * {@inheritDoc}
54
-     *
55
-     * {@internal The Place is associated to a Point only.
56
-     * PlaceLocation can calculate a BoundingBox.
57
-     * Using a BoundingBox could make the mapping more complex and potentially arbitary.
58
-     * Furthermore, when no coordinate is found for the place or its children, then it bubbles up to the parents.
59
-     * This could create the unwanted side effect of a very large area to consider}
60
-     *
61
-     * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::map()
62
-     */
63
-    public function map(Place $place, string $feature_property): ?string
64
-    {
65
-        $location = new PlaceLocation($place->gedcomName());
66
-        $longitude = $location->longitude();
67
-        $latitude = $location->latitude();
68
-        if ($longitude === null || $latitude === null) {
69
-            return null;
70
-        }
71
-
72
-        $features_index = $this->featuresIndex();
73
-        if ($features_index === null) {
74
-            return null;
75
-        }
76
-
77
-        $place_point = Point::xy($longitude, $latitude, $features_index['SRID']);
78
-        $grid_box = $this->getGridCell(
79
-            $place_point,
80
-            $features_index['map_NE'],
81
-            $features_index['map_SW'],
82
-            $features_index['nb_columns']
83
-        );
84
-        if ($grid_box === null || !$this->setGeometryEngine() || $this->geometry_engine === null) {
85
-            return null;
86
-        }
87
-        $features = $features_index['grid'][$grid_box[0]][$grid_box[1]];
88
-        foreach ($features as $feature) {
89
-            $geometry = $feature->getGeometry();
90
-            if (
91
-                $geometry !== null && $place_point->SRID() === $geometry->SRID() &&
92
-                $this->geometry_engine->contains($geometry, $place_point)
93
-            ) {
94
-                return $feature->getProperty($feature_property);
95
-            }
96
-        }
97
-        return null;
98
-    }
99
-
100
-    /**
101
-     * Return the XY coordinates in a bounded grid of the cell containing a specific point.
102
-     *
103
-     * @param Point $point Point to find
104
-     * @param Point $grid_NE North-East point of the bounded grid
105
-     * @param Point $grid_SW South-West point fo the bounded grid
106
-     * @param int $grid_columns Number of columns/rows in the grid
107
-     * @return int[]|NULL
108
-     */
109
-    protected function getGridCell(Point $point, Point $grid_NE, Point $grid_SW, int $grid_columns): ?array
110
-    {
111
-        list($x, $y) = [$point->x() ?? 0, $point->y() ?? 0];
112
-        list($x_max, $y_max) = [$grid_NE->x() ?? 0, $grid_NE->y() ?? 0];
113
-        list($x_min, $y_min) = [$grid_SW->x() ?? 0, $grid_SW->y() ?? 0];
114
-
115
-        $x_step = ($x_max - $x_min) / $grid_columns;
116
-        $y_step = ($y_max - $y_min) / $grid_columns;
117
-
118
-        if ($x_min <= $x && $x <= $x_max && $y_min <= $y && $y <= $y_max) {
119
-            return [
120
-                $x === $x_max ? $grid_columns - 1 : intval(($x - $x_min) / $x_step),
121
-                $y === $y_max ? $grid_columns - 1 : intval(($y - $y_min) / $y_step)
122
-            ];
123
-        }
124
-        return null;
125
-    }
126
-
127
-    /**
128
-     * Get an indexed array of the features of the map.
129
-     *
130
-     * {@internal The map is divided in a grid, each cell containing the features which bounding box overlaps that cell.
131
-     * The grid is computed once for each map, and cached.}
132
-     *
133
-     * @phpcs:ignore Generic.Files.LineLength.TooLong
134
-     * @return array{grid: array<int, array<int, \Brick\Geo\IO\GeoJSON\Feature[]>>, nb_columns: int, map_NE: \Brick\Geo\Point, map_SW: \Brick\Geo\Point, SRID: int}|NULL
135
-     */
136
-    protected function featuresIndex(): ?array
137
-    {
138
-        $cacheKey = $this->cacheKey();
139
-        if ($cacheKey === null) {
140
-            return null;
141
-        }
142
-        return Registry::cache()->array()->remember($cacheKey, function (): ?array {
143
-            $map_def = $this->data('map');
144
-            if (
145
-                !$this->setGeometryEngine()
146
-                || $map_def === null
147
-                || !($map_def instanceof MapDefinitionInterface)
148
-            ) {
149
-                return null;
150
-            }
151
-            $bounding_boxes = [];
152
-            $map_bounding_box = new BoundingBox();
153
-            $srid = 0;
154
-            foreach ($map_def->features() as $feature) {
155
-                $geometry = $feature->getGeometry();
156
-                if ($geometry === null) {
157
-                    continue;
158
-                }
159
-                $srid = $geometry->SRID();
160
-                $bounding_box = $geometry->getBoundingBox();
161
-                $bounding_boxes[] = [$feature, $bounding_box];
162
-                $map_bounding_box = $map_bounding_box->extendedWithBoundingBox($bounding_box);
163
-            }
164
-            $grid_columns = count($bounding_boxes);
165
-            $grid = array_fill(0, $grid_columns, array_fill(0, $grid_columns, []));
166
-            $map_NE = $map_bounding_box->getNorthEast();
167
-            $map_SW = $map_bounding_box->getSouthWest();
168
-            foreach ($bounding_boxes as $item) {
169
-                $grid_box_SW = $this->getGridCell($item[1]->getSouthWest(), $map_NE, $map_SW, $grid_columns) ?? [1, 1];
170
-                $grid_box_NE = $this->getGridCell($item[1]->getNorthEast(), $map_NE, $map_SW, $grid_columns) ?? [0, 0];
171
-                for ($i = $grid_box_SW[0]; $i <= $grid_box_NE[0]; $i++) {
172
-                    for ($j = $grid_box_SW[1]; $j <= $grid_box_NE[1]; $j++) {
173
-                        $grid[$i][$j][] = $item[0];
174
-                    }
175
-                }
176
-            }
177
-            return [
178
-                'grid'          =>  $grid,
179
-                'nb_columns'    =>  $grid_columns,
180
-                'map_NE'        =>  $map_NE,
181
-                'map_SW'        =>  $map_SW,
182
-                'SRID'          =>  $srid
183
-            ];
184
-        });
185
-    }
186
-
187
-    /**
188
-     * Set the Brick Geo Engine to use the database for geospatial computations.
189
-     * The engine is set only if it has not been set beforehand.
190
-     *
191
-     * @return bool
192
-     */
193
-    protected function setGeometryEngine(): bool
194
-    {
195
-        try {
196
-            if ($this->geometry_engine === null) {
197
-                $this->geometry_engine = new PDOEngine(DB::connection()->getPdo());
198
-            }
199
-            $point = Point::xy(1, 1);
200
-            return $this->geometry_engine->equals($point, $point);
201
-        } catch (Throwable $ex) {
202
-        }
203
-        return false;
204
-    }
205
-
206
-    /**
207
-     * Get the key to cache the indexed grid of features.
208
-     *
209
-     * @return string|NULL
210
-     */
211
-    protected function cacheKey(): ?string
212
-    {
213
-        $map_def = $this->data('map');
214
-        if ($map_def === null || !($map_def instanceof MapDefinitionInterface)) {
215
-            return null;
216
-        }
217
-        return spl_object_id($this) . '-map-' . $map_def->id();
218
-    }
39
+	use PlaceMapperTrait;
40
+
41
+	private ?GeometryEngine $geometry_engine = null;
42
+
43
+	/**
44
+	 * {@inheritDoc}
45
+	 * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::title()
46
+	 */
47
+	public function title(): string
48
+	{
49
+		return I18N::translate('Mapping on place coordinates');
50
+	}
51
+
52
+	/**
53
+	 * {@inheritDoc}
54
+	 *
55
+	 * {@internal The Place is associated to a Point only.
56
+	 * PlaceLocation can calculate a BoundingBox.
57
+	 * Using a BoundingBox could make the mapping more complex and potentially arbitary.
58
+	 * Furthermore, when no coordinate is found for the place or its children, then it bubbles up to the parents.
59
+	 * This could create the unwanted side effect of a very large area to consider}
60
+	 *
61
+	 * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\PlaceMapperInterface::map()
62
+	 */
63
+	public function map(Place $place, string $feature_property): ?string
64
+	{
65
+		$location = new PlaceLocation($place->gedcomName());
66
+		$longitude = $location->longitude();
67
+		$latitude = $location->latitude();
68
+		if ($longitude === null || $latitude === null) {
69
+			return null;
70
+		}
71
+
72
+		$features_index = $this->featuresIndex();
73
+		if ($features_index === null) {
74
+			return null;
75
+		}
76
+
77
+		$place_point = Point::xy($longitude, $latitude, $features_index['SRID']);
78
+		$grid_box = $this->getGridCell(
79
+			$place_point,
80
+			$features_index['map_NE'],
81
+			$features_index['map_SW'],
82
+			$features_index['nb_columns']
83
+		);
84
+		if ($grid_box === null || !$this->setGeometryEngine() || $this->geometry_engine === null) {
85
+			return null;
86
+		}
87
+		$features = $features_index['grid'][$grid_box[0]][$grid_box[1]];
88
+		foreach ($features as $feature) {
89
+			$geometry = $feature->getGeometry();
90
+			if (
91
+				$geometry !== null && $place_point->SRID() === $geometry->SRID() &&
92
+				$this->geometry_engine->contains($geometry, $place_point)
93
+			) {
94
+				return $feature->getProperty($feature_property);
95
+			}
96
+		}
97
+		return null;
98
+	}
99
+
100
+	/**
101
+	 * Return the XY coordinates in a bounded grid of the cell containing a specific point.
102
+	 *
103
+	 * @param Point $point Point to find
104
+	 * @param Point $grid_NE North-East point of the bounded grid
105
+	 * @param Point $grid_SW South-West point fo the bounded grid
106
+	 * @param int $grid_columns Number of columns/rows in the grid
107
+	 * @return int[]|NULL
108
+	 */
109
+	protected function getGridCell(Point $point, Point $grid_NE, Point $grid_SW, int $grid_columns): ?array
110
+	{
111
+		list($x, $y) = [$point->x() ?? 0, $point->y() ?? 0];
112
+		list($x_max, $y_max) = [$grid_NE->x() ?? 0, $grid_NE->y() ?? 0];
113
+		list($x_min, $y_min) = [$grid_SW->x() ?? 0, $grid_SW->y() ?? 0];
114
+
115
+		$x_step = ($x_max - $x_min) / $grid_columns;
116
+		$y_step = ($y_max - $y_min) / $grid_columns;
117
+
118
+		if ($x_min <= $x && $x <= $x_max && $y_min <= $y && $y <= $y_max) {
119
+			return [
120
+				$x === $x_max ? $grid_columns - 1 : intval(($x - $x_min) / $x_step),
121
+				$y === $y_max ? $grid_columns - 1 : intval(($y - $y_min) / $y_step)
122
+			];
123
+		}
124
+		return null;
125
+	}
126
+
127
+	/**
128
+	 * Get an indexed array of the features of the map.
129
+	 *
130
+	 * {@internal The map is divided in a grid, each cell containing the features which bounding box overlaps that cell.
131
+	 * The grid is computed once for each map, and cached.}
132
+	 *
133
+	 * @phpcs:ignore Generic.Files.LineLength.TooLong
134
+	 * @return array{grid: array<int, array<int, \Brick\Geo\IO\GeoJSON\Feature[]>>, nb_columns: int, map_NE: \Brick\Geo\Point, map_SW: \Brick\Geo\Point, SRID: int}|NULL
135
+	 */
136
+	protected function featuresIndex(): ?array
137
+	{
138
+		$cacheKey = $this->cacheKey();
139
+		if ($cacheKey === null) {
140
+			return null;
141
+		}
142
+		return Registry::cache()->array()->remember($cacheKey, function (): ?array {
143
+			$map_def = $this->data('map');
144
+			if (
145
+				!$this->setGeometryEngine()
146
+				|| $map_def === null
147
+				|| !($map_def instanceof MapDefinitionInterface)
148
+			) {
149
+				return null;
150
+			}
151
+			$bounding_boxes = [];
152
+			$map_bounding_box = new BoundingBox();
153
+			$srid = 0;
154
+			foreach ($map_def->features() as $feature) {
155
+				$geometry = $feature->getGeometry();
156
+				if ($geometry === null) {
157
+					continue;
158
+				}
159
+				$srid = $geometry->SRID();
160
+				$bounding_box = $geometry->getBoundingBox();
161
+				$bounding_boxes[] = [$feature, $bounding_box];
162
+				$map_bounding_box = $map_bounding_box->extendedWithBoundingBox($bounding_box);
163
+			}
164
+			$grid_columns = count($bounding_boxes);
165
+			$grid = array_fill(0, $grid_columns, array_fill(0, $grid_columns, []));
166
+			$map_NE = $map_bounding_box->getNorthEast();
167
+			$map_SW = $map_bounding_box->getSouthWest();
168
+			foreach ($bounding_boxes as $item) {
169
+				$grid_box_SW = $this->getGridCell($item[1]->getSouthWest(), $map_NE, $map_SW, $grid_columns) ?? [1, 1];
170
+				$grid_box_NE = $this->getGridCell($item[1]->getNorthEast(), $map_NE, $map_SW, $grid_columns) ?? [0, 0];
171
+				for ($i = $grid_box_SW[0]; $i <= $grid_box_NE[0]; $i++) {
172
+					for ($j = $grid_box_SW[1]; $j <= $grid_box_NE[1]; $j++) {
173
+						$grid[$i][$j][] = $item[0];
174
+					}
175
+				}
176
+			}
177
+			return [
178
+				'grid'          =>  $grid,
179
+				'nb_columns'    =>  $grid_columns,
180
+				'map_NE'        =>  $map_NE,
181
+				'map_SW'        =>  $map_SW,
182
+				'SRID'          =>  $srid
183
+			];
184
+		});
185
+	}
186
+
187
+	/**
188
+	 * Set the Brick Geo Engine to use the database for geospatial computations.
189
+	 * The engine is set only if it has not been set beforehand.
190
+	 *
191
+	 * @return bool
192
+	 */
193
+	protected function setGeometryEngine(): bool
194
+	{
195
+		try {
196
+			if ($this->geometry_engine === null) {
197
+				$this->geometry_engine = new PDOEngine(DB::connection()->getPdo());
198
+			}
199
+			$point = Point::xy(1, 1);
200
+			return $this->geometry_engine->equals($point, $point);
201
+		} catch (Throwable $ex) {
202
+		}
203
+		return false;
204
+	}
205
+
206
+	/**
207
+	 * Get the key to cache the indexed grid of features.
208
+	 *
209
+	 * @return string|NULL
210
+	 */
211
+	protected function cacheKey(): ?string
212
+	{
213
+		$map_def = $this->data('map');
214
+		if ($map_def === null || !($map_def instanceof MapDefinitionInterface)) {
215
+			return null;
216
+		}
217
+		return spl_object_id($this) . '-map-' . $map_def->id();
218
+	}
219 219
 }
Please login to merge, or discard this patch.
app/Module/GeoDispersion/Http/RequestHandlers/MapAdapterEditAction.php 1 patch
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -36,85 +36,85 @@
 block discarded – undo
36 36
  */
37 37
 class MapAdapterEditAction implements RequestHandlerInterface
38 38
 {
39
-    private ?GeoDispersionModule $module;
40
-    private MapAdapterDataService $mapadapter_data_service;
41
-    private MapDefinitionsService $map_definition_service;
39
+	private ?GeoDispersionModule $module;
40
+	private MapAdapterDataService $mapadapter_data_service;
41
+	private MapDefinitionsService $map_definition_service;
42 42
 
43
-    /**
44
-     * Constructor for MapAdapterEditAction Request Handler
45
-     *
46
-     * @param ModuleService $module_service
47
-     * @param MapAdapterDataService $mapadapter_data_service
48
-     * @param MapDefinitionsService $map_definition_service
49
-     */
50
-    public function __construct(
51
-        ModuleService $module_service,
52
-        MapAdapterDataService $mapadapter_data_service,
53
-        MapDefinitionsService $map_definition_service
54
-    ) {
55
-        $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
56
-        $this->mapadapter_data_service = $mapadapter_data_service;
57
-        $this->map_definition_service = $map_definition_service;
58
-    }
43
+	/**
44
+	 * Constructor for MapAdapterEditAction Request Handler
45
+	 *
46
+	 * @param ModuleService $module_service
47
+	 * @param MapAdapterDataService $mapadapter_data_service
48
+	 * @param MapDefinitionsService $map_definition_service
49
+	 */
50
+	public function __construct(
51
+		ModuleService $module_service,
52
+		MapAdapterDataService $mapadapter_data_service,
53
+		MapDefinitionsService $map_definition_service
54
+	) {
55
+		$this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
56
+		$this->mapadapter_data_service = $mapadapter_data_service;
57
+		$this->map_definition_service = $map_definition_service;
58
+	}
59 59
 
60
-    /**
61
-     * {@inheritDoc}
62
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
63
-     */
64
-    public function handle(ServerRequestInterface $request): ResponseInterface
65
-    {
66
-        $tree = Validator::attributes($request)->tree();
60
+	/**
61
+	 * {@inheritDoc}
62
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
63
+	 */
64
+	public function handle(ServerRequestInterface $request): ResponseInterface
65
+	{
66
+		$tree = Validator::attributes($request)->tree();
67 67
 
68
-        if ($this->module === null) {
69
-            FlashMessages::addMessage(
70
-                I18N::translate('The attached module could not be found.'),
71
-                'danger'
72
-            );
73
-            return Registry::responseFactory()->redirect(HomePage::class, ['tree' => $tree->name()]);
74
-        }
68
+		if ($this->module === null) {
69
+			FlashMessages::addMessage(
70
+				I18N::translate('The attached module could not be found.'),
71
+				'danger'
72
+			);
73
+			return Registry::responseFactory()->redirect(HomePage::class, ['tree' => $tree->name()]);
74
+		}
75 75
 
76
-        $adapter_id = Validator::attributes($request)->integer('adapter_id', -1);
77
-        $map_adapter = $this->mapadapter_data_service->find($adapter_id);
76
+		$adapter_id = Validator::attributes($request)->integer('adapter_id', -1);
77
+		$map_adapter = $this->mapadapter_data_service->find($adapter_id);
78 78
 
79
-        $map = $this->map_definition_service->find(Validator::parsedBody($request)->string('map_adapter_map', ''));
80
-        $mapping_property   = Validator::parsedBody($request)->string('map_adapter_property_selected', '');
79
+		$map = $this->map_definition_service->find(Validator::parsedBody($request)->string('map_adapter_map', ''));
80
+		$mapping_property   = Validator::parsedBody($request)->string('map_adapter_property_selected', '');
81 81
 
82
-        $mapper = null;
83
-        try {
84
-            $mapper = app(Validator::parsedBody($request)->string('map_adapter_mapper', ''));
85
-        } catch (BindingResolutionException $ex) {
86
-        }
82
+		$mapper = null;
83
+		try {
84
+			$mapper = app(Validator::parsedBody($request)->string('map_adapter_mapper', ''));
85
+		} catch (BindingResolutionException $ex) {
86
+		}
87 87
 
88
-        if ($map_adapter === null || $map === null || $mapper === null || !($mapper instanceof PlaceMapperInterface)) {
89
-            FlashMessages::addMessage(
90
-                I18N::translate('The parameters for the map configuration are not valid.'),
91
-                'danger'
92
-            );
93
-            return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
94
-        }
88
+		if ($map_adapter === null || $map === null || $mapper === null || !($mapper instanceof PlaceMapperInterface)) {
89
+			FlashMessages::addMessage(
90
+				I18N::translate('The parameters for the map configuration are not valid.'),
91
+				'danger'
92
+			);
93
+			return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
94
+		}
95 95
 
96
-        $mapper->setConfig($mapper->config()->withConfigUpdate($request));
97
-        $new_map_adapter = $map_adapter->with($map, $mapper, $mapping_property);
98
-        try {
99
-            $this->mapadapter_data_service->update($new_map_adapter);
100
-            FlashMessages::addMessage(
101
-                I18N::translate('The map configuration has been successfully updated.'),
102
-                'success'
103
-            );
104
-            //phpcs:ignore Generic.Files.LineLength.TooLong
105
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $map_adapter->id() . '” has been updated.');
106
-        } catch (Throwable $ex) {
107
-            FlashMessages::addMessage(
108
-                I18N::translate('An error occured while updating the map configuration.'),
109
-                'danger'
110
-            );
111
-            //phpcs:ignore Generic.Files.LineLength.TooLong
112
-            Log::addErrorLog('Module ' . $this->module->title() . ' : Error when updating Map Adapter “' . $map_adapter->id() . '”: ' . $ex->getMessage());
113
-        }
96
+		$mapper->setConfig($mapper->config()->withConfigUpdate($request));
97
+		$new_map_adapter = $map_adapter->with($map, $mapper, $mapping_property);
98
+		try {
99
+			$this->mapadapter_data_service->update($new_map_adapter);
100
+			FlashMessages::addMessage(
101
+				I18N::translate('The map configuration has been successfully updated.'),
102
+				'success'
103
+			);
104
+			//phpcs:ignore Generic.Files.LineLength.TooLong
105
+			Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $map_adapter->id() . '” has been updated.');
106
+		} catch (Throwable $ex) {
107
+			FlashMessages::addMessage(
108
+				I18N::translate('An error occured while updating the map configuration.'),
109
+				'danger'
110
+			);
111
+			//phpcs:ignore Generic.Files.LineLength.TooLong
112
+			Log::addErrorLog('Module ' . $this->module->title() . ' : Error when updating Map Adapter “' . $map_adapter->id() . '”: ' . $ex->getMessage());
113
+		}
114 114
 
115
-        return Registry::responseFactory()->redirect(MapAdapterEditPage::class, [
116
-            'tree' => $tree->name(),
117
-            'adapter_id' => $map_adapter->id()
118
-        ]);
119
-    }
115
+		return Registry::responseFactory()->redirect(MapAdapterEditPage::class, [
116
+			'tree' => $tree->name(),
117
+			'adapter_id' => $map_adapter->id()
118
+		]);
119
+	}
120 120
 }
Please login to merge, or discard this patch.
Module/GeoDispersion/Http/RequestHandlers/MapAdapterDeleteInvalidAction.php 1 patch
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -36,77 +36,77 @@
 block discarded – undo
36 36
  */
37 37
 class MapAdapterDeleteInvalidAction implements RequestHandlerInterface
38 38
 {
39
-    private ?GeoDispersionModule $module;
40
-    private GeoAnalysisViewDataService $geoview_data_service;
41
-    private MapAdapterDataService $mapadapter_data_service;
39
+	private ?GeoDispersionModule $module;
40
+	private GeoAnalysisViewDataService $geoview_data_service;
41
+	private MapAdapterDataService $mapadapter_data_service;
42 42
 
43
-    /**
44
-     * Constructor for MapAdapterDeleteInvalidAction Request Handler
45
-     *
46
-     * @param ModuleService $module_service
47
-     * @param GeoAnalysisViewDataService $geoview_data_service
48
-     * @param MapAdapterDataService $mapadapter_data_service
49
-     */
50
-    public function __construct(
51
-        ModuleService $module_service,
52
-        GeoAnalysisViewDataService $geoview_data_service,
53
-        MapAdapterDataService $mapadapter_data_service
54
-    ) {
55
-        $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
56
-        $this->geoview_data_service = $geoview_data_service;
57
-        $this->mapadapter_data_service = $mapadapter_data_service;
58
-    }
43
+	/**
44
+	 * Constructor for MapAdapterDeleteInvalidAction Request Handler
45
+	 *
46
+	 * @param ModuleService $module_service
47
+	 * @param GeoAnalysisViewDataService $geoview_data_service
48
+	 * @param MapAdapterDataService $mapadapter_data_service
49
+	 */
50
+	public function __construct(
51
+		ModuleService $module_service,
52
+		GeoAnalysisViewDataService $geoview_data_service,
53
+		MapAdapterDataService $mapadapter_data_service
54
+	) {
55
+		$this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
56
+		$this->geoview_data_service = $geoview_data_service;
57
+		$this->mapadapter_data_service = $mapadapter_data_service;
58
+	}
59 59
 
60
-    /**
61
-     * {@inheritDoc}
62
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
63
-     */
64
-    public function handle(ServerRequestInterface $request): ResponseInterface
65
-    {
66
-        $tree = Validator::attributes($request)->tree();
60
+	/**
61
+	 * {@inheritDoc}
62
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
63
+	 */
64
+	public function handle(ServerRequestInterface $request): ResponseInterface
65
+	{
66
+		$tree = Validator::attributes($request)->tree();
67 67
 
68
-        if ($this->module === null) {
69
-            FlashMessages::addMessage(
70
-                I18N::translate('The attached module could not be found.'),
71
-                'danger'
72
-            );
73
-            return Registry::responseFactory()->redirect(HomePage::class, ['tree' => $tree->name()]);
74
-        }
68
+		if ($this->module === null) {
69
+			FlashMessages::addMessage(
70
+				I18N::translate('The attached module could not be found.'),
71
+				'danger'
72
+			);
73
+			return Registry::responseFactory()->redirect(HomePage::class, ['tree' => $tree->name()]);
74
+		}
75 75
 
76
-        $view_id = Validator::attributes($request)->integer('view_id', -1);
77
-        $view = $this->geoview_data_service->find($tree, $view_id);
76
+		$view_id = Validator::attributes($request)->integer('view_id', -1);
77
+		$view = $this->geoview_data_service->find($tree, $view_id);
78 78
 
79
-        if ($view === null || !($view instanceof GeoAnalysisMap)) {
80
-            FlashMessages::addMessage(
81
-                I18N::translate('The view with ID “%s” does not exist.', I18N::number($view_id)),
82
-                'danger'
83
-            );
84
-            return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
85
-        }
79
+		if ($view === null || !($view instanceof GeoAnalysisMap)) {
80
+			FlashMessages::addMessage(
81
+				I18N::translate('The view with ID “%s” does not exist.', I18N::number($view_id)),
82
+				'danger'
83
+			);
84
+			return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
85
+		}
86 86
 
87
-        /** @var \Illuminate\Support\Collection<int> $valid_map_adapters */
88
-        $valid_map_adapters = $this->mapadapter_data_service
89
-            ->allForView($view)
90
-            ->map(fn(GeoAnalysisMapAdapter $map_adapter): int => $map_adapter->id());
87
+		/** @var \Illuminate\Support\Collection<int> $valid_map_adapters */
88
+		$valid_map_adapters = $this->mapadapter_data_service
89
+			->allForView($view)
90
+			->map(fn(GeoAnalysisMapAdapter $map_adapter): int => $map_adapter->id());
91 91
 
92
-        try {
93
-            $this->mapadapter_data_service->deleteInvalid($view, $valid_map_adapters);
94
-            FlashMessages::addMessage(
95
-                I18N::translate('The invalid map configurations have been successfully deleted.'),
96
-                'success'
97
-            );
98
-        } catch (Throwable $ex) {
99
-            FlashMessages::addMessage(
100
-                I18N::translate('An error occured while deleting the invalid map configurations.'),
101
-                'danger'
102
-            );
103
-            //phpcs:ignore Generic.Files.LineLength.TooLong
104
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Error when deleting invalid map configurations: ' . $ex->getMessage());
105
-        }
92
+		try {
93
+			$this->mapadapter_data_service->deleteInvalid($view, $valid_map_adapters);
94
+			FlashMessages::addMessage(
95
+				I18N::translate('The invalid map configurations have been successfully deleted.'),
96
+				'success'
97
+			);
98
+		} catch (Throwable $ex) {
99
+			FlashMessages::addMessage(
100
+				I18N::translate('An error occured while deleting the invalid map configurations.'),
101
+				'danger'
102
+			);
103
+			//phpcs:ignore Generic.Files.LineLength.TooLong
104
+			Log::addConfigurationLog('Module ' . $this->module->title() . ' : Error when deleting invalid map configurations: ' . $ex->getMessage());
105
+		}
106 106
 
107
-        return Registry::responseFactory()->redirect(GeoAnalysisViewEditPage::class, [
108
-            'tree'      => $tree->name(),
109
-            'view_id'   => $view_id
110
-        ]);
111
-    }
107
+		return Registry::responseFactory()->redirect(GeoAnalysisViewEditPage::class, [
108
+			'tree'      => $tree->name(),
109
+			'view_id'   => $view_id
110
+		]);
111
+	}
112 112
 }
Please login to merge, or discard this patch.
Module/GeoDispersion/Http/RequestHandlers/GeoAnalysisViewStatusAction.php 1 patch
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -33,65 +33,65 @@
 block discarded – undo
33 33
  */
34 34
 class GeoAnalysisViewStatusAction implements RequestHandlerInterface
35 35
 {
36
-    private ?GeoDispersionModule $module;
37
-    private GeoAnalysisViewDataService $geoview_data_service;
36
+	private ?GeoDispersionModule $module;
37
+	private GeoAnalysisViewDataService $geoview_data_service;
38 38
 
39
-    /**
40
-     * Constructor for GeoAnalysisViewStatusAction Request Handler
41
-     *
42
-     * @param ModuleService $module_service
43
-     * @param GeoAnalysisViewDataService $geoview_data_service
44
-     */
45
-    public function __construct(ModuleService $module_service, GeoAnalysisViewDataService $geoview_data_service)
46
-    {
47
-        $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
48
-        $this->geoview_data_service = $geoview_data_service;
49
-    }
39
+	/**
40
+	 * Constructor for GeoAnalysisViewStatusAction Request Handler
41
+	 *
42
+	 * @param ModuleService $module_service
43
+	 * @param GeoAnalysisViewDataService $geoview_data_service
44
+	 */
45
+	public function __construct(ModuleService $module_service, GeoAnalysisViewDataService $geoview_data_service)
46
+	{
47
+		$this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
48
+		$this->geoview_data_service = $geoview_data_service;
49
+	}
50 50
 
51
-    /**
52
-     * {@inheritDoc}
53
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
54
-     */
55
-    public function handle(ServerRequestInterface $request): ResponseInterface
56
-    {
57
-        $tree = Validator::attributes($request)->tree();
51
+	/**
52
+	 * {@inheritDoc}
53
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
54
+	 */
55
+	public function handle(ServerRequestInterface $request): ResponseInterface
56
+	{
57
+		$tree = Validator::attributes($request)->tree();
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 Registry::responseFactory()->redirect(HomePage::class, ['tree' => $tree->name()]);
65
-        }
59
+		if ($this->module === null) {
60
+			FlashMessages::addMessage(
61
+				I18N::translate('The attached module could not be found.'),
62
+				'danger'
63
+			);
64
+			return Registry::responseFactory()->redirect(HomePage::class, ['tree' => $tree->name()]);
65
+		}
66 66
 
67
-        $view_id = Validator::attributes($request)->integer('view_id', -1);
68
-        $view = $this->geoview_data_service->find($tree, $view_id, true);
67
+		$view_id = Validator::attributes($request)->integer('view_id', -1);
68
+		$view = $this->geoview_data_service->find($tree, $view_id, true);
69 69
 
70
-        if ($view === null) {
71
-            FlashMessages::addMessage(
72
-                I18N::translate('The view with ID “%s” does not exist.', I18N::number($view_id)),
73
-                'danger'
74
-            );
75
-            return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
76
-        }
70
+		if ($view === null) {
71
+			FlashMessages::addMessage(
72
+				I18N::translate('The view with ID “%s” does not exist.', I18N::number($view_id)),
73
+				'danger'
74
+			);
75
+			return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
76
+		}
77 77
 
78
-        try {
79
-            $this->geoview_data_service->updateStatus($view, Validator::attributes($request)->boolean('enable', false));
80
-            FlashMessages::addMessage(
81
-                I18N::translate('The geographical dispersion analysis view has been successfully updated.'),
82
-                'success'
83
-            );
84
-            //phpcs:ignore Generic.Files.LineLength.TooLong
85
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been updated.');
86
-        } catch (Throwable $ex) {
87
-            FlashMessages::addMessage(
88
-                I18N::translate('An error occured while updating the geographical dispersion analysis view.'),
89
-                'danger'
90
-            );
91
-            //phpcs:ignore Generic.Files.LineLength.TooLong
92
-            Log::addErrorLog('Module ' . $this->module->title() . ' : Error when updating view “' . $view->id() . '”: ' . $ex->getMessage());
93
-        }
78
+		try {
79
+			$this->geoview_data_service->updateStatus($view, Validator::attributes($request)->boolean('enable', false));
80
+			FlashMessages::addMessage(
81
+				I18N::translate('The geographical dispersion analysis view has been successfully updated.'),
82
+				'success'
83
+			);
84
+			//phpcs:ignore Generic.Files.LineLength.TooLong
85
+			Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been updated.');
86
+		} catch (Throwable $ex) {
87
+			FlashMessages::addMessage(
88
+				I18N::translate('An error occured while updating the geographical dispersion analysis view.'),
89
+				'danger'
90
+			);
91
+			//phpcs:ignore Generic.Files.LineLength.TooLong
92
+			Log::addErrorLog('Module ' . $this->module->title() . ' : Error when updating view “' . $view->id() . '”: ' . $ex->getMessage());
93
+		}
94 94
 
95
-        return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
96
-    }
95
+		return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
96
+	}
97 97
 }
Please login to merge, or discard this patch.
app/Module/GeoDispersion/Http/RequestHandlers/MapAdapterDeleteAction.php 1 patch
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -32,67 +32,67 @@
 block discarded – undo
32 32
  */
33 33
 class MapAdapterDeleteAction implements RequestHandlerInterface
34 34
 {
35
-    private ?GeoDispersionModule $module;
36
-    private MapAdapterDataService $mapadapter_data_service;
35
+	private ?GeoDispersionModule $module;
36
+	private MapAdapterDataService $mapadapter_data_service;
37 37
 
38
-    /**
39
-     * Constructor for MapAdapterDeleteAction Request Handler
40
-     *
41
-     * @param ModuleService $module_service
42
-     * @param MapAdapterDataService $mapadapter_data_service
43
-     */
44
-    public function __construct(ModuleService $module_service, MapAdapterDataService $mapadapter_data_service)
45
-    {
46
-        $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
47
-        $this->mapadapter_data_service = $mapadapter_data_service;
48
-    }
38
+	/**
39
+	 * Constructor for MapAdapterDeleteAction Request Handler
40
+	 *
41
+	 * @param ModuleService $module_service
42
+	 * @param MapAdapterDataService $mapadapter_data_service
43
+	 */
44
+	public function __construct(ModuleService $module_service, MapAdapterDataService $mapadapter_data_service)
45
+	{
46
+		$this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
47
+		$this->mapadapter_data_service = $mapadapter_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
-        if ($this->module === null) {
59
-            FlashMessages::addMessage(
60
-                I18N::translate('The attached module could not be found.'),
61
-                'danger'
62
-            );
63
-            return Registry::responseFactory()->redirect(HomePage::class, ['tree' => $tree->name()]);
64
-        }
58
+		if ($this->module === null) {
59
+			FlashMessages::addMessage(
60
+				I18N::translate('The attached module could not be found.'),
61
+				'danger'
62
+			);
63
+			return Registry::responseFactory()->redirect(HomePage::class, ['tree' => $tree->name()]);
64
+		}
65 65
 
66
-        $adapter_id = Validator::attributes($request)->integer('adapter_id', -1);
67
-        $map_adapter = $this->mapadapter_data_service->find($adapter_id);
66
+		$adapter_id = Validator::attributes($request)->integer('adapter_id', -1);
67
+		$map_adapter = $this->mapadapter_data_service->find($adapter_id);
68 68
 
69
-        if ($map_adapter === null) {
70
-            FlashMessages::addMessage(
71
-                I18N::translate('The map configuration with ID “%s” does not exist.', I18N::number($adapter_id)),
72
-                'danger'
73
-            );
74
-            return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
75
-        }
69
+		if ($map_adapter === null) {
70
+			FlashMessages::addMessage(
71
+				I18N::translate('The map configuration with ID “%s” does not exist.', I18N::number($adapter_id)),
72
+				'danger'
73
+			);
74
+			return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
75
+		}
76 76
 
77
-        if ($this->mapadapter_data_service->delete($map_adapter) > 0) {
78
-            FlashMessages::addMessage(
79
-                I18N::translate('The map configuration has been successfully deleted.'),
80
-                'success'
81
-            );
82
-            //phpcs:ignore Generic.Files.LineLength.TooLong
83
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $map_adapter->id() . '” has been deleted.');
84
-        } else {
85
-            FlashMessages::addMessage(
86
-                I18N::translate('An error occured while deleting the map configuration.'),
87
-                'danger'
88
-            );
89
-            //phpcs:ignore Generic.Files.LineLength.TooLong
90
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $map_adapter->id() . '” could not be deleted. See error log.');
91
-        }
77
+		if ($this->mapadapter_data_service->delete($map_adapter) > 0) {
78
+			FlashMessages::addMessage(
79
+				I18N::translate('The map configuration has been successfully deleted.'),
80
+				'success'
81
+			);
82
+			//phpcs:ignore Generic.Files.LineLength.TooLong
83
+			Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $map_adapter->id() . '” has been deleted.');
84
+		} else {
85
+			FlashMessages::addMessage(
86
+				I18N::translate('An error occured while deleting the map configuration.'),
87
+				'danger'
88
+			);
89
+			//phpcs:ignore Generic.Files.LineLength.TooLong
90
+			Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $map_adapter->id() . '” could not be deleted. See error log.');
91
+		}
92 92
 
93
-        return Registry::responseFactory()->redirect(GeoAnalysisViewEditPage::class, [
94
-            'tree'      => $tree->name(),
95
-            'view_id'   => $map_adapter->geoAnalysisViewId()
96
-        ]);
97
-    }
93
+		return Registry::responseFactory()->redirect(GeoAnalysisViewEditPage::class, [
94
+			'tree'      => $tree->name(),
95
+			'view_id'   => $map_adapter->geoAnalysisViewId()
96
+		]);
97
+	}
98 98
 }
Please login to merge, or discard this patch.
Module/GeoDispersion/Http/RequestHandlers/GeoAnalysisViewDeleteAction.php 1 patch
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -32,64 +32,64 @@
 block discarded – undo
32 32
  */
33 33
 class GeoAnalysisViewDeleteAction 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 GeoAnalysisViewDeleteAction 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 GeoAnalysisViewDeleteAction 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
-        if ($this->module === null) {
59
-            FlashMessages::addMessage(
60
-                I18N::translate('The attached module could not be found.'),
61
-                'danger'
62
-            );
63
-            return Registry::responseFactory()->redirect(HomePage::class, ['tree' => $tree->name()]);
64
-        }
58
+		if ($this->module === null) {
59
+			FlashMessages::addMessage(
60
+				I18N::translate('The attached module could not be found.'),
61
+				'danger'
62
+			);
63
+			return Registry::responseFactory()->redirect(HomePage::class, ['tree' => $tree->name()]);
64
+		}
65 65
 
66
-        $view_id = Validator::attributes($request)->integer('view_id', -1);
67
-        $view = $this->geoview_data_service->find($tree, $view_id, true);
66
+		$view_id = Validator::attributes($request)->integer('view_id', -1);
67
+		$view = $this->geoview_data_service->find($tree, $view_id, true);
68 68
 
69
-        if ($view === null) {
70
-            FlashMessages::addMessage(
71
-                I18N::translate('The view with ID “%s” does not exist.', I18N::number($view_id)),
72
-                'danger'
73
-            );
74
-            return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
75
-        }
69
+		if ($view === null) {
70
+			FlashMessages::addMessage(
71
+				I18N::translate('The view with ID “%s” does not exist.', I18N::number($view_id)),
72
+				'danger'
73
+			);
74
+			return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
75
+		}
76 76
 
77
-        if ($this->geoview_data_service->delete($view) > 0) {
78
-            FlashMessages::addMessage(
79
-                I18N::translate('The geographical dispersion analysis view has been successfully deleted.'),
80
-                'success'
81
-            );
82
-            //phpcs:ignore Generic.Files.LineLength.TooLong
83
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been deleted.');
84
-        } else {
85
-            FlashMessages::addMessage(
86
-                I18N::translate('An error occured while deleting the geographical dispersion analysis view.'),
87
-                'danger'
88
-            );
89
-            //phpcs:ignore Generic.Files.LineLength.TooLong
90
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” could not be deleted. See error log.');
91
-        }
77
+		if ($this->geoview_data_service->delete($view) > 0) {
78
+			FlashMessages::addMessage(
79
+				I18N::translate('The geographical dispersion analysis view has been successfully deleted.'),
80
+				'success'
81
+			);
82
+			//phpcs:ignore Generic.Files.LineLength.TooLong
83
+			Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been deleted.');
84
+		} else {
85
+			FlashMessages::addMessage(
86
+				I18N::translate('An error occured while deleting the geographical dispersion analysis view.'),
87
+				'danger'
88
+			);
89
+			//phpcs:ignore Generic.Files.LineLength.TooLong
90
+			Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” could not be deleted. See error log.');
91
+		}
92 92
 
93
-        return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
94
-    }
93
+		return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
94
+	}
95 95
 }
Please login to merge, or discard this patch.
app/Module/GeoDispersion/Http/RequestHandlers/MapAdapterAddAction.php 1 patch
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -38,95 +38,95 @@
 block discarded – undo
38 38
  */
39 39
 class MapAdapterAddAction implements RequestHandlerInterface
40 40
 {
41
-    private ?GeoDispersionModule $module;
42
-    private GeoAnalysisViewDataService $geoview_data_service;
43
-    private MapAdapterDataService $mapadapter_data_service;
44
-    private MapDefinitionsService $map_definition_service;
41
+	private ?GeoDispersionModule $module;
42
+	private GeoAnalysisViewDataService $geoview_data_service;
43
+	private MapAdapterDataService $mapadapter_data_service;
44
+	private MapDefinitionsService $map_definition_service;
45 45
 
46
-    /**
47
-     * Constructor for MapAdapterAddAction Request Handler
48
-     *
49
-     * @param ModuleService $module_service
50
-     * @param GeoAnalysisViewDataService $geoview_data_service
51
-     * @param MapAdapterDataService $mapadapter_data_service
52
-     * @param MapDefinitionsService $map_definition_service
53
-     */
54
-    public function __construct(
55
-        ModuleService $module_service,
56
-        GeoAnalysisViewDataService $geoview_data_service,
57
-        MapAdapterDataService $mapadapter_data_service,
58
-        MapDefinitionsService $map_definition_service
59
-    ) {
60
-        $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
61
-        $this->geoview_data_service = $geoview_data_service;
62
-        $this->mapadapter_data_service = $mapadapter_data_service;
63
-        $this->map_definition_service = $map_definition_service;
64
-    }
46
+	/**
47
+	 * Constructor for MapAdapterAddAction Request Handler
48
+	 *
49
+	 * @param ModuleService $module_service
50
+	 * @param GeoAnalysisViewDataService $geoview_data_service
51
+	 * @param MapAdapterDataService $mapadapter_data_service
52
+	 * @param MapDefinitionsService $map_definition_service
53
+	 */
54
+	public function __construct(
55
+		ModuleService $module_service,
56
+		GeoAnalysisViewDataService $geoview_data_service,
57
+		MapAdapterDataService $mapadapter_data_service,
58
+		MapDefinitionsService $map_definition_service
59
+	) {
60
+		$this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
61
+		$this->geoview_data_service = $geoview_data_service;
62
+		$this->mapadapter_data_service = $mapadapter_data_service;
63
+		$this->map_definition_service = $map_definition_service;
64
+	}
65 65
 
66
-    /**
67
-     * {@inheritDoc}
68
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
69
-     */
70
-    public function handle(ServerRequestInterface $request): ResponseInterface
71
-    {
72
-        $tree = Validator::attributes($request)->tree();
66
+	/**
67
+	 * {@inheritDoc}
68
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
69
+	 */
70
+	public function handle(ServerRequestInterface $request): ResponseInterface
71
+	{
72
+		$tree = Validator::attributes($request)->tree();
73 73
 
74
-        if ($this->module === null) {
75
-            FlashMessages::addMessage(
76
-                I18N::translate('The attached module could not be found.'),
77
-                'danger'
78
-            );
79
-            return Registry::responseFactory()->redirect(HomePage::class, ['tree' => $tree->name()]);
80
-        }
74
+		if ($this->module === null) {
75
+			FlashMessages::addMessage(
76
+				I18N::translate('The attached module could not be found.'),
77
+				'danger'
78
+			);
79
+			return Registry::responseFactory()->redirect(HomePage::class, ['tree' => $tree->name()]);
80
+		}
81 81
 
82
-        $view_id = Validator::attributes($request)->integer('view_id', -1);
83
-        $view = $this->geoview_data_service->find($tree, $view_id);
82
+		$view_id = Validator::attributes($request)->integer('view_id', -1);
83
+		$view = $this->geoview_data_service->find($tree, $view_id);
84 84
 
85
-        $map = $this->map_definition_service->find(Validator::parsedBody($request)->string('map_adapter_map', ''));
86
-        $mapping_property   = Validator::parsedBody($request)->string('map_adapter_property_selected', '');
85
+		$map = $this->map_definition_service->find(Validator::parsedBody($request)->string('map_adapter_map', ''));
86
+		$mapping_property   = Validator::parsedBody($request)->string('map_adapter_property_selected', '');
87 87
 
88
-        $mapper = null;
89
-        try {
90
-            $mapper = app(Validator::parsedBody($request)->string('map_adapter_mapper', ''));
91
-        } catch (BindingResolutionException $ex) {
92
-        }
88
+		$mapper = null;
89
+		try {
90
+			$mapper = app(Validator::parsedBody($request)->string('map_adapter_mapper', ''));
91
+		} catch (BindingResolutionException $ex) {
92
+		}
93 93
 
94
-        if ($view === null || $map === null || $mapper === null || !($mapper instanceof PlaceMapperInterface)) {
95
-            FlashMessages::addMessage(
96
-                I18N::translate('The parameters for the map configuration are not valid.'),
97
-                'danger'
98
-            );
99
-            return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
100
-        }
94
+		if ($view === null || $map === null || $mapper === null || !($mapper instanceof PlaceMapperInterface)) {
95
+			FlashMessages::addMessage(
96
+				I18N::translate('The parameters for the map configuration are not valid.'),
97
+				'danger'
98
+			);
99
+			return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
100
+		}
101 101
 
102
-        $new_adapter_id = $this->mapadapter_data_service->insertGetId(
103
-            new GeoAnalysisMapAdapter(
104
-                0,
105
-                $view_id,
106
-                $map,
107
-                $mapper,
108
-                new MapViewConfig($mapping_property, $mapper->config()->withConfigUpdate($request))
109
-            )
110
-        );
111
-        if ($new_adapter_id > 0) {
112
-            FlashMessages::addMessage(
113
-                I18N::translate('The map configuration has been successfully added.'),
114
-                'success'
115
-            );
116
-            //phpcs:ignore Generic.Files.LineLength.TooLong
117
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $new_adapter_id . '” has been added.');
118
-        } else {
119
-            FlashMessages::addMessage(
120
-                I18N::translate('An error occured while adding a new map configuration.'),
121
-                'danger'
122
-            );
123
-            //phpcs:ignore Generic.Files.LineLength.TooLong
124
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter could not be added. See error log.');
125
-        }
102
+		$new_adapter_id = $this->mapadapter_data_service->insertGetId(
103
+			new GeoAnalysisMapAdapter(
104
+				0,
105
+				$view_id,
106
+				$map,
107
+				$mapper,
108
+				new MapViewConfig($mapping_property, $mapper->config()->withConfigUpdate($request))
109
+			)
110
+		);
111
+		if ($new_adapter_id > 0) {
112
+			FlashMessages::addMessage(
113
+				I18N::translate('The map configuration has been successfully added.'),
114
+				'success'
115
+			);
116
+			//phpcs:ignore Generic.Files.LineLength.TooLong
117
+			Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $new_adapter_id . '” has been added.');
118
+		} else {
119
+			FlashMessages::addMessage(
120
+				I18N::translate('An error occured while adding a new map configuration.'),
121
+				'danger'
122
+			);
123
+			//phpcs:ignore Generic.Files.LineLength.TooLong
124
+			Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter could not be added. See error log.');
125
+		}
126 126
 
127
-        return Registry::responseFactory()->redirect(GeoAnalysisViewEditPage::class, [
128
-            'tree' => $tree->name(),
129
-            'view_id' => $view_id
130
-        ]);
131
-    }
127
+		return Registry::responseFactory()->redirect(GeoAnalysisViewEditPage::class, [
128
+			'tree' => $tree->name(),
129
+			'view_id' => $view_id
130
+		]);
131
+	}
132 132
 }
Please login to merge, or discard this patch.