Passed
Push — main ( ad76dd...bc3fc8 )
by Jonathan
12:59
created
app/Module/AdminTasks/Http/RequestHandlers/TaskEditPage.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -31,58 +31,58 @@
 block discarded – undo
31 31
  */
32 32
 class TaskEditPage implements RequestHandlerInterface
33 33
 {
34
-    use ViewResponseTrait;
34
+	use ViewResponseTrait;
35 35
 
36
-    private ?AdminTasksModule $module;
37
-    private TaskScheduleService $taskschedules_service;
36
+	private ?AdminTasksModule $module;
37
+	private TaskScheduleService $taskschedules_service;
38 38
 
39
-    /**
40
-     * Constructor for TaskEditPage Request Handler
41
-     *
42
-     * @param ModuleService $module_service
43
-     * @param TaskScheduleService $taskschedules_service
44
-     */
45
-    public function __construct(ModuleService $module_service, TaskScheduleService $taskschedules_service)
46
-    {
47
-        $this->module = $module_service->findByInterface(AdminTasksModule::class)->first();
48
-        $this->taskschedules_service = $taskschedules_service;
49
-    }
39
+	/**
40
+	 * Constructor for TaskEditPage Request Handler
41
+	 *
42
+	 * @param ModuleService $module_service
43
+	 * @param TaskScheduleService $taskschedules_service
44
+	 */
45
+	public function __construct(ModuleService $module_service, TaskScheduleService $taskschedules_service)
46
+	{
47
+		$this->module = $module_service->findByInterface(AdminTasksModule::class)->first();
48
+		$this->taskschedules_service = $taskschedules_service;
49
+	}
50 50
 
51
-    /**
52
-     * {@inheritDoc}
53
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
54
-     */
55
-    public function handle(ServerRequestInterface $request): ResponseInterface
56
-    {
57
-        $this->layout = 'layouts/administration';
51
+	/**
52
+	 * {@inheritDoc}
53
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
54
+	 */
55
+	public function handle(ServerRequestInterface $request): ResponseInterface
56
+	{
57
+		$this->layout = 'layouts/administration';
58 58
 
59
-        if ($this->module === null) {
60
-            throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
61
-        }
59
+		if ($this->module === null) {
60
+			throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
61
+		}
62 62
 
63
-        $task_sched_id = Validator::attributes($request)->integer('task', -1);
64
-        $task_schedule = $this->taskschedules_service->find($task_sched_id);
63
+		$task_sched_id = Validator::attributes($request)->integer('task', -1);
64
+		$task_schedule = $this->taskschedules_service->find($task_sched_id);
65 65
 
66
-        if ($task_schedule === null) {
67
-            throw new HttpNotFoundException(I18N::translate('The Task schedule could not be found.'));
68
-        }
66
+		if ($task_schedule === null) {
67
+			throw new HttpNotFoundException(I18N::translate('The Task schedule could not be found.'));
68
+		}
69 69
 
70
-        $task = $this->taskschedules_service->findTask($task_schedule->taskId());
70
+		$task = $this->taskschedules_service->findTask($task_schedule->taskId());
71 71
 
72
-        if ($task === null) {
73
-            throw new HttpNotFoundException(I18N::translate('The Task schedule could not be found.'));
74
-        }
72
+		if ($task === null) {
73
+			throw new HttpNotFoundException(I18N::translate('The Task schedule could not be found.'));
74
+		}
75 75
 
76
-        $has_task_config = $task instanceof ConfigurableTaskInterface;
77
-        /** @var \MyArtJaub\Webtrees\Contracts\Tasks\TaskInterface&\MyArtJaub\Webtrees\Contracts\Tasks\ConfigurableTaskInterface $task */
76
+		$has_task_config = $task instanceof ConfigurableTaskInterface;
77
+		/** @var \MyArtJaub\Webtrees\Contracts\Tasks\TaskInterface&\MyArtJaub\Webtrees\Contracts\Tasks\ConfigurableTaskInterface $task */
78 78
 
79
-        return $this->viewResponse($this->module->name() . '::admin/tasks-edit', [
80
-            'module'            =>  $this->module,
81
-            'title'             =>  I18N::translate('Edit the administrative task') . ' - ' . $task->name(),
82
-            'task_schedule'     =>  $task_schedule,
83
-            'task'              =>  $task,
84
-            'has_task_config'   =>  $has_task_config,
85
-            'task_config_view'  =>  $has_task_config ? $task->configView($request) : ''
86
-        ]);
87
-    }
79
+		return $this->viewResponse($this->module->name() . '::admin/tasks-edit', [
80
+			'module'            =>  $this->module,
81
+			'title'             =>  I18N::translate('Edit the administrative task') . ' - ' . $task->name(),
82
+			'task_schedule'     =>  $task_schedule,
83
+			'task'              =>  $task,
84
+			'has_task_config'   =>  $has_task_config,
85
+			'task_config_view'  =>  $has_task_config ? $task->configView($request) : ''
86
+		]);
87
+	}
88 88
 }
Please login to merge, or discard this patch.
app/Module/AdminTasks/Services/HealthCheckService.php 1 patch
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -27,101 +27,101 @@
 block discarded – undo
27 27
  */
28 28
 class HealthCheckService
29 29
 {
30
-    /**
31
-     * Returns a query collating all gedcom records, for use in other queries
32
-     *
33
-     * @param Tree $tree
34
-     * @return Builder
35
-     */
36
-    private function allGedcomRecords(Tree $tree): Builder
37
-    {
38
-        return DB::table('individuals')
39
-            ->select(DB::raw("'indi' AS ged_type"), 'i_id AS ged_id')->where('i_file', '=', $tree->id())
40
-            ->unionAll(DB::table('families')
41
-                ->select(DB::raw("'fam' AS ged_type"), 'f_id AS ged_id')->where('f_file', '=', $tree->id()))
42
-            ->unionAll(DB::table('sources')
43
-                ->select(DB::raw("'sour' AS ged_type"), 's_id AS ged_id')->where('s_file', '=', $tree->id()))
44
-            ->unionAll(DB::table('media')
45
-                ->select(DB::raw("'media' AS ged_type"), 'm_id AS ged_id')->where('m_file', '=', $tree->id()))
46
-            ->unionAll(DB::table('other')
47
-                ->select(DB::raw('LOWER(o_type) AS ged_type'), 'o_id AS ged_id')->where('o_file', '=', $tree->id()));
48
-    }
30
+	/**
31
+	 * Returns a query collating all gedcom records, for use in other queries
32
+	 *
33
+	 * @param Tree $tree
34
+	 * @return Builder
35
+	 */
36
+	private function allGedcomRecords(Tree $tree): Builder
37
+	{
38
+		return DB::table('individuals')
39
+			->select(DB::raw("'indi' AS ged_type"), 'i_id AS ged_id')->where('i_file', '=', $tree->id())
40
+			->unionAll(DB::table('families')
41
+				->select(DB::raw("'fam' AS ged_type"), 'f_id AS ged_id')->where('f_file', '=', $tree->id()))
42
+			->unionAll(DB::table('sources')
43
+				->select(DB::raw("'sour' AS ged_type"), 's_id AS ged_id')->where('s_file', '=', $tree->id()))
44
+			->unionAll(DB::table('media')
45
+				->select(DB::raw("'media' AS ged_type"), 'm_id AS ged_id')->where('m_file', '=', $tree->id()))
46
+			->unionAll(DB::table('other')
47
+				->select(DB::raw('LOWER(o_type) AS ged_type'), 'o_id AS ged_id')->where('o_file', '=', $tree->id()));
48
+	}
49 49
 
50
-    /**
51
-     * Returns the count of gedcom records by type in a Tree, as a keyed Collection.
52
-     *
53
-     * Collection output:
54
-     *      - Key : gedcom record type
55
-     *      - Value: count of records
56
-     *
57
-     * @param Tree $tree
58
-     * @return Collection<string, int>
59
-     */
60
-    public function countByRecordType(Tree $tree): Collection
61
-    {
62
-        return DB::query()
63
-            ->fromSub($this->allGedcomRecords($tree), 'gedrecords')
64
-            ->select('ged_type', new Expression('COUNT(ged_id) AS total'))
65
-            ->groupBy('ged_type')
66
-            ->pluck('total', 'ged_type');
67
-    }
50
+	/**
51
+	 * Returns the count of gedcom records by type in a Tree, as a keyed Collection.
52
+	 *
53
+	 * Collection output:
54
+	 *      - Key : gedcom record type
55
+	 *      - Value: count of records
56
+	 *
57
+	 * @param Tree $tree
58
+	 * @return Collection<string, int>
59
+	 */
60
+	public function countByRecordType(Tree $tree): Collection
61
+	{
62
+		return DB::query()
63
+			->fromSub($this->allGedcomRecords($tree), 'gedrecords')
64
+			->select('ged_type', new Expression('COUNT(ged_id) AS total'))
65
+			->groupBy('ged_type')
66
+			->pluck('total', 'ged_type');
67
+	}
68 68
 
69
-    /**
70
-     * Returns the count of gedcom records changes by type in a Tree across a number of days, as a keyed Collection.
71
-     *
72
-     * Collection output:
73
-     *      - Key : gedcom record type
74
-     *      - Value: count of changes
75
-     *
76
-     * @param Tree $tree
77
-     * @return Collection<string, int>
78
-     */
79
-    public function changesByRecordType(Tree $tree, int $nb_days): Collection
80
-    {
81
-        return DB::table('change')
82
-            ->joinSub($this->allGedcomRecords($tree), 'gedrecords', function (JoinClause $join) use ($tree): void {
69
+	/**
70
+	 * Returns the count of gedcom records changes by type in a Tree across a number of days, as a keyed Collection.
71
+	 *
72
+	 * Collection output:
73
+	 *      - Key : gedcom record type
74
+	 *      - Value: count of changes
75
+	 *
76
+	 * @param Tree $tree
77
+	 * @return Collection<string, int>
78
+	 */
79
+	public function changesByRecordType(Tree $tree, int $nb_days): Collection
80
+	{
81
+		return DB::table('change')
82
+			->joinSub($this->allGedcomRecords($tree), 'gedrecords', function (JoinClause $join) use ($tree): void {
83 83
 
84
-                $join->on('change.xref', '=', 'gedrecords.ged_id')
85
-                    ->where('change.gedcom_id', '=', $tree->id());
86
-            })
87
-            ->select('ged_type AS type', new Expression('COUNT(change_id) AS count'))
88
-            ->where('change.status', '', 'accepted')
89
-            ->where('change.change_time', '>=', Carbon::now()->subDays($nb_days))
90
-            ->groupBy('ged_type')
91
-            ->pluck('total', 'ged_type');
92
-    }
84
+				$join->on('change.xref', '=', 'gedrecords.ged_id')
85
+					->where('change.gedcom_id', '=', $tree->id());
86
+			})
87
+			->select('ged_type AS type', new Expression('COUNT(change_id) AS count'))
88
+			->where('change.status', '', 'accepted')
89
+			->where('change.change_time', '>=', Carbon::now()->subDays($nb_days))
90
+			->groupBy('ged_type')
91
+			->pluck('total', 'ged_type');
92
+	}
93 93
 
94
-    /**
95
-     * Return the error logs associated with a tree across a number of days, grouped by error message, as a Collection.
96
-     *
97
-     * Collection output:
98
-     *      - Value: stdClass object
99
-     *          - log message:  Error log message
100
-     *          - type:         'site' if no associated Tree, the Tree ID otherwise
101
-     *          - nblogs:       The number of occurrence of the same error message
102
-     *          - lastoccurred: Date/time of the last occurrence of the error message
103
-     *
104
-     * @param Tree $tree
105
-     * @param int $nb_days
106
-     * @return Collection<\stdClass>
107
-     */
108
-    public function errorLogs(Tree $tree, int $nb_days): Collection
109
-    {
110
-        return DB::table('log')
111
-            ->select(
112
-                'log_message',
113
-                new Expression("IFNULL(gedcom_id, 'site') as type"),
114
-                new Expression('COUNT(log_id) AS nblogs'),
115
-                new Expression('MAX(log_time) AS lastoccurred')
116
-            )
117
-            ->where('log_type', '=', 'error')
118
-            ->where(function (Builder $query) use ($tree): void {
119
-                $query->where('gedcom_id', '=', $tree->id())
120
-                    ->orWhereNull('gedcom_id');
121
-            })
122
-            ->where('log_time', '>=', Carbon::now()->subDays($nb_days))
123
-            ->groupBy('log_message', 'gedcom_id')
124
-            ->orderByDesc('lastoccurred')
125
-            ->get();
126
-    }
94
+	/**
95
+	 * Return the error logs associated with a tree across a number of days, grouped by error message, as a Collection.
96
+	 *
97
+	 * Collection output:
98
+	 *      - Value: stdClass object
99
+	 *          - log message:  Error log message
100
+	 *          - type:         'site' if no associated Tree, the Tree ID otherwise
101
+	 *          - nblogs:       The number of occurrence of the same error message
102
+	 *          - lastoccurred: Date/time of the last occurrence of the error message
103
+	 *
104
+	 * @param Tree $tree
105
+	 * @param int $nb_days
106
+	 * @return Collection<\stdClass>
107
+	 */
108
+	public function errorLogs(Tree $tree, int $nb_days): Collection
109
+	{
110
+		return DB::table('log')
111
+			->select(
112
+				'log_message',
113
+				new Expression("IFNULL(gedcom_id, 'site') as type"),
114
+				new Expression('COUNT(log_id) AS nblogs'),
115
+				new Expression('MAX(log_time) AS lastoccurred')
116
+			)
117
+			->where('log_type', '=', 'error')
118
+			->where(function (Builder $query) use ($tree): void {
119
+				$query->where('gedcom_id', '=', $tree->id())
120
+					->orWhereNull('gedcom_id');
121
+			})
122
+			->where('log_time', '>=', Carbon::now()->subDays($nb_days))
123
+			->groupBy('log_message', 'gedcom_id')
124
+			->orderByDesc('lastoccurred')
125
+			->get();
126
+	}
127 127
 }
Please login to merge, or discard this patch.
app/Module/GeoDispersion/Views/GeoAnalysisMap.php 1 patch
Indentation   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -32,117 +32,117 @@
 block discarded – undo
32 32
  */
33 33
 class GeoAnalysisMap extends AbstractGeoAnalysisView
34 34
 {
35
-    private ?MapColorsConfig $colors_config = null;
36
-
37
-    public function type(): string
38
-    {
39
-        return I18N::translateContext('GEODISPERSION', 'Map');
40
-    }
41
-
42
-    /**
43
-     * {@inheritDoc}
44
-     * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisView::icon()
45
-     */
46
-    public function icon(ModuleInterface $module): string
47
-    {
48
-        return view($module->name() . '::icons/view-map', ['type' => $this->type()]);
49
-    }
50
-
51
-    /**
52
-     * {@inheritDoc}
53
-     * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisView::globalSettingsContent()
54
-     */
55
-    public function globalSettingsContent(ModuleInterface $module): string
56
-    {
57
-        return view($module->name() . '::admin/view-edit-map', [
58
-            'module_name'   =>  $module->name(),
59
-            'view'          =>  $this,
60
-            'colors'        =>  $this->colors(),
61
-            'map_adapters'  =>  app(MapAdapterDataService::class)->allForView($this, true)
62
-        ]);
63
-    }
64
-
65
-    /**
66
-     * {@inheritDoc}
67
-     * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisView::withGlobalSettingsUpdate()
68
-     * @return static
69
-     */
70
-    public function withGlobalSettingsUpdate(ServerRequestInterface $request): self
71
-    {
72
-        $default_color  = Validator::parsedBody($request)->string('view_map_color_default', '');
73
-        $stroke_color   = Validator::parsedBody($request)->string('view_map_color_stroke', '');
74
-        $maxvalue_color  = Validator::parsedBody($request)->string('view_map_color_maxvalue', '');
75
-        $hover_color  = Validator::parsedBody($request)->string('view_map_color_hover', '');
76
-
77
-        try {
78
-            return $this->withColors(new MapColorsConfig(
79
-                Hex::fromString($default_color),
80
-                Hex::fromString($stroke_color),
81
-                Hex::fromString($maxvalue_color),
82
-                Hex::fromString($hover_color)
83
-            ));
84
-        } catch (InvalidColorValue $ex) {
85
-        }
86
-
87
-        return $this;
88
-    }
89
-
90
-    /**
91
-     * {@inheritDoc}
92
-     * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisView::globalTabContent()
93
-     */
94
-    public function globalTabContent(GeoDispersionModule $module, GeoAnalysisResult $result, array $params): string
95
-    {
96
-        $map_adapters = app(MapAdapterDataService::class)->allForView($this);
97
-
98
-        $adapter_result = null;
99
-        foreach ($map_adapters as $map_adapter) {
100
-            $adapter_result_tmp = $map_adapter->convert($result);
101
-            $adapter_result = $adapter_result === null ?
102
-                $adapter_result_tmp :
103
-                $adapter_result->merge($adapter_result_tmp);
104
-        }
105
-
106
-        if ($adapter_result === null) {
107
-            return view($module->name() . '::errors/tab-error', [
108
-                'message'   =>  I18N::translate('The map could not be loaded.'),
109
-            ]);
110
-        }
111
-
112
-        return view($module->name() . '::geoanalysisview-tab-glb-map', $params + [
113
-            'result'            =>  $adapter_result->geoAnalysisResult(),
114
-            'features'          =>  $adapter_result->features(),
115
-            'colors'            =>  $this->colors(),
116
-            'leaflet_config'    =>  app(LeafletJsService::class)->config(),
117
-            'js_script_url'     =>  $module->assetUrl('js/geodispersion.min.js')
118
-        ]);
119
-    }
120
-
121
-    /**
122
-     * Get the color scheme configuration for the map view
123
-     *
124
-     * @return MapColorsConfig
125
-     */
126
-    public function colors(): MapColorsConfig
127
-    {
128
-        return $this->colors_config ?? new MapColorsConfig(
129
-            new Rgb(245, 245, 245),
130
-            new Rgb(213, 213, 213),
131
-            new Rgb(4, 147, 171),
132
-            new Rgb(255, 102, 0)
133
-        );
134
-    }
135
-
136
-    /**
137
-     * Returns a map view with a new color scheme configuration
138
-     *
139
-     * @param MapColorsConfig $config
140
-     * @return static
141
-     */
142
-    public function withColors(?MapColorsConfig $config): self
143
-    {
144
-        $new = clone $this;
145
-        $new->colors_config = $config;
146
-        return $new;
147
-    }
35
+	private ?MapColorsConfig $colors_config = null;
36
+
37
+	public function type(): string
38
+	{
39
+		return I18N::translateContext('GEODISPERSION', 'Map');
40
+	}
41
+
42
+	/**
43
+	 * {@inheritDoc}
44
+	 * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisView::icon()
45
+	 */
46
+	public function icon(ModuleInterface $module): string
47
+	{
48
+		return view($module->name() . '::icons/view-map', ['type' => $this->type()]);
49
+	}
50
+
51
+	/**
52
+	 * {@inheritDoc}
53
+	 * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisView::globalSettingsContent()
54
+	 */
55
+	public function globalSettingsContent(ModuleInterface $module): string
56
+	{
57
+		return view($module->name() . '::admin/view-edit-map', [
58
+			'module_name'   =>  $module->name(),
59
+			'view'          =>  $this,
60
+			'colors'        =>  $this->colors(),
61
+			'map_adapters'  =>  app(MapAdapterDataService::class)->allForView($this, true)
62
+		]);
63
+	}
64
+
65
+	/**
66
+	 * {@inheritDoc}
67
+	 * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisView::withGlobalSettingsUpdate()
68
+	 * @return static
69
+	 */
70
+	public function withGlobalSettingsUpdate(ServerRequestInterface $request): self
71
+	{
72
+		$default_color  = Validator::parsedBody($request)->string('view_map_color_default', '');
73
+		$stroke_color   = Validator::parsedBody($request)->string('view_map_color_stroke', '');
74
+		$maxvalue_color  = Validator::parsedBody($request)->string('view_map_color_maxvalue', '');
75
+		$hover_color  = Validator::parsedBody($request)->string('view_map_color_hover', '');
76
+
77
+		try {
78
+			return $this->withColors(new MapColorsConfig(
79
+				Hex::fromString($default_color),
80
+				Hex::fromString($stroke_color),
81
+				Hex::fromString($maxvalue_color),
82
+				Hex::fromString($hover_color)
83
+			));
84
+		} catch (InvalidColorValue $ex) {
85
+		}
86
+
87
+		return $this;
88
+	}
89
+
90
+	/**
91
+	 * {@inheritDoc}
92
+	 * @see \MyArtJaub\Webtrees\Module\GeoDispersion\Views\AbstractGeoAnalysisView::globalTabContent()
93
+	 */
94
+	public function globalTabContent(GeoDispersionModule $module, GeoAnalysisResult $result, array $params): string
95
+	{
96
+		$map_adapters = app(MapAdapterDataService::class)->allForView($this);
97
+
98
+		$adapter_result = null;
99
+		foreach ($map_adapters as $map_adapter) {
100
+			$adapter_result_tmp = $map_adapter->convert($result);
101
+			$adapter_result = $adapter_result === null ?
102
+				$adapter_result_tmp :
103
+				$adapter_result->merge($adapter_result_tmp);
104
+		}
105
+
106
+		if ($adapter_result === null) {
107
+			return view($module->name() . '::errors/tab-error', [
108
+				'message'   =>  I18N::translate('The map could not be loaded.'),
109
+			]);
110
+		}
111
+
112
+		return view($module->name() . '::geoanalysisview-tab-glb-map', $params + [
113
+			'result'            =>  $adapter_result->geoAnalysisResult(),
114
+			'features'          =>  $adapter_result->features(),
115
+			'colors'            =>  $this->colors(),
116
+			'leaflet_config'    =>  app(LeafletJsService::class)->config(),
117
+			'js_script_url'     =>  $module->assetUrl('js/geodispersion.min.js')
118
+		]);
119
+	}
120
+
121
+	/**
122
+	 * Get the color scheme configuration for the map view
123
+	 *
124
+	 * @return MapColorsConfig
125
+	 */
126
+	public function colors(): MapColorsConfig
127
+	{
128
+		return $this->colors_config ?? new MapColorsConfig(
129
+			new Rgb(245, 245, 245),
130
+			new Rgb(213, 213, 213),
131
+			new Rgb(4, 147, 171),
132
+			new Rgb(255, 102, 0)
133
+		);
134
+	}
135
+
136
+	/**
137
+	 * Returns a map view with a new color scheme configuration
138
+	 *
139
+	 * @param MapColorsConfig $config
140
+	 * @return static
141
+	 */
142
+	public function withColors(?MapColorsConfig $config): self
143
+	{
144
+		$new = clone $this;
145
+		$new->colors_config = $config;
146
+		return $new;
147
+	}
148 148
 }
Please login to merge, or discard this patch.
app/Module/GeoDispersion/Schema/Migration0.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@
 block discarded – undo
21 21
  */
22 22
 class Migration0 implements MigrationInterface
23 23
 {
24
-    /**
25
-     * {@inheritDoc}
26
-     * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade()
27
-     */
28
-    public function upgrade(): void
29
-    {
30
-        // This migration has been superseded by migration 1.
31
-    }
24
+	/**
25
+	 * {@inheritDoc}
26
+	 * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade()
27
+	 */
28
+	public function upgrade(): void
29
+	{
30
+		// This migration has been superseded by migration 1.
31
+	}
32 32
 }
Please login to merge, or discard this patch.
app/Module/GeoDispersion/Schema/Migration2.php 1 patch
Indentation   +193 added lines, -193 removed lines patch added patch discarded remove patch
@@ -39,219 +39,219 @@
 block discarded – undo
39 39
  */
40 40
 class Migration2 implements MigrationInterface
41 41
 {
42
-    /**
43
-     * Mapping from old map definitions to new ones
44
-     * @var array<string,mixed> MAPS_XML_MAPPING
45
-     */
46
-    private const MAPS_XML_MAPPING = [
47
-        'aubracmargeridebycommunes.xml' =>  'fr-area-aubrac-lot-margeride-planeze-communes',
48
-        'calvadosbycommunes.xml'        =>  'fr-dpt-14-communes',
49
-        'cantalbycommunes.xml'          =>  'fr-dpt-15-communes',
50
-        'cotesdarmorbycommunes.xml'     =>  'fr-dpt-22-communes',
51
-        'essonnebycommunes.xml'         =>  'fr-dpt-91-communes',
52
-        'eurebycommunes.xml'            =>  'fr-dpt-27-communes',
53
-        'eureetloirbycommunes.xml'      =>  'fr-dpt-28-communes',
54
-        'francebydepartements.xml'      =>  'fr-metropole-departements',
55
-        'francebyregions1970.xml'       =>  'fr-metropole-regions-1970',
56
-        'francebyregions2016.xml'       =>  'fr-metropole-regions-2016',
57
-        'hauteloirebycommunes.xml'      =>  'fr-dpt-43-communes',
58
-        'illeetvilainebycommunes.xml'   =>  'fr-dpt-35-communes',
59
-        'loiretbycommunes.xml'          =>  'fr-dpt-45-communes',
60
-        'lozerebycodepostaux.xml'       =>  'fr-dpt-48-codespostaux',
61
-        'lozerebycommunes.xml'          =>  'fr-dpt-48-communes',
62
-        'mayennebycommunes.xml'         =>  'fr-dpt-53-communes',
63
-        'oisebycommunes.xml'            =>  'fr-dpt-60-communes',
64
-        'ornebycommunes.xml'            =>  'fr-dpt-61-communes',
65
-        'puydedomebycommunes.xml'       =>  'fr-dpt-63-communes',
66
-        'sarthebycommunes.xml'          =>  'fr-dpt-72-communes',
67
-        'seinemaritimebycommunes.xml'   =>  'fr-dpt-76-communes',
68
-        'seinesommeoisebycommunes.xml'  =>  ['fr-dpt-60-communes', 'fr-dpt-76-communes', 'fr-dpt-80-communes'],
69
-        'valdoisebycommunes.xml'        =>  'fr-dpt-95-communes',
70
-        'yvelinesbycommunes.xml'        =>  'fr-dpt-78-communes'
71
-    ];
42
+	/**
43
+	 * Mapping from old map definitions to new ones
44
+	 * @var array<string,mixed> MAPS_XML_MAPPING
45
+	 */
46
+	private const MAPS_XML_MAPPING = [
47
+		'aubracmargeridebycommunes.xml' =>  'fr-area-aubrac-lot-margeride-planeze-communes',
48
+		'calvadosbycommunes.xml'        =>  'fr-dpt-14-communes',
49
+		'cantalbycommunes.xml'          =>  'fr-dpt-15-communes',
50
+		'cotesdarmorbycommunes.xml'     =>  'fr-dpt-22-communes',
51
+		'essonnebycommunes.xml'         =>  'fr-dpt-91-communes',
52
+		'eurebycommunes.xml'            =>  'fr-dpt-27-communes',
53
+		'eureetloirbycommunes.xml'      =>  'fr-dpt-28-communes',
54
+		'francebydepartements.xml'      =>  'fr-metropole-departements',
55
+		'francebyregions1970.xml'       =>  'fr-metropole-regions-1970',
56
+		'francebyregions2016.xml'       =>  'fr-metropole-regions-2016',
57
+		'hauteloirebycommunes.xml'      =>  'fr-dpt-43-communes',
58
+		'illeetvilainebycommunes.xml'   =>  'fr-dpt-35-communes',
59
+		'loiretbycommunes.xml'          =>  'fr-dpt-45-communes',
60
+		'lozerebycodepostaux.xml'       =>  'fr-dpt-48-codespostaux',
61
+		'lozerebycommunes.xml'          =>  'fr-dpt-48-communes',
62
+		'mayennebycommunes.xml'         =>  'fr-dpt-53-communes',
63
+		'oisebycommunes.xml'            =>  'fr-dpt-60-communes',
64
+		'ornebycommunes.xml'            =>  'fr-dpt-61-communes',
65
+		'puydedomebycommunes.xml'       =>  'fr-dpt-63-communes',
66
+		'sarthebycommunes.xml'          =>  'fr-dpt-72-communes',
67
+		'seinemaritimebycommunes.xml'   =>  'fr-dpt-76-communes',
68
+		'seinesommeoisebycommunes.xml'  =>  ['fr-dpt-60-communes', 'fr-dpt-76-communes', 'fr-dpt-80-communes'],
69
+		'valdoisebycommunes.xml'        =>  'fr-dpt-95-communes',
70
+		'yvelinesbycommunes.xml'        =>  'fr-dpt-78-communes'
71
+	];
72 72
 
73
-    /**
74
-     * {@inheritDoc}
75
-     * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade()
76
-     */
77
-    public function upgrade(): void
78
-    {
79
-        if (!DB::schema()->hasTable('maj_geodispersion')) {
80
-            return;
81
-        }
73
+	/**
74
+	 * {@inheritDoc}
75
+	 * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade()
76
+	 */
77
+	public function upgrade(): void
78
+	{
79
+		if (!DB::schema()->hasTable('maj_geodispersion')) {
80
+			return;
81
+		}
82 82
 
83
-        /** @var TreeService $tree_service */
84
-        $tree_service = app(TreeService::class);
85
-        /** @var GeoAnalysisViewDataService $geoview_data_service */
86
-        $geoview_data_service = app(GeoAnalysisViewDataService::class);
83
+		/** @var TreeService $tree_service */
84
+		$tree_service = app(TreeService::class);
85
+		/** @var GeoAnalysisViewDataService $geoview_data_service */
86
+		$geoview_data_service = app(GeoAnalysisViewDataService::class);
87 87
 
88
-        $existing_views = DB::table('maj_geodispersion')
89
-            ->select()
90
-            ->get();
88
+		$existing_views = DB::table('maj_geodispersion')
89
+			->select()
90
+			->get();
91 91
 
92
-        foreach ($existing_views as $old_view) {
93
-            try {
94
-                $tree = $tree_service->find((int) $old_view->majgd_file);
95
-            } catch (RuntimeException $ex) {
96
-                continue;
97
-            }
92
+		foreach ($existing_views as $old_view) {
93
+			try {
94
+				$tree = $tree_service->find((int) $old_view->majgd_file);
95
+			} catch (RuntimeException $ex) {
96
+				continue;
97
+			}
98 98
 
99
-            if ($old_view->majgd_map === null) {
100
-                $this->migrateGeoAnalysisTable($old_view, $tree, $geoview_data_service);
101
-            } else {
102
-                DB::connection()->beginTransaction();
103
-                if ($this->migrateGeoAnalysisMap($old_view, $tree, $geoview_data_service)) {
104
-                    DB::connection()->commit();
105
-                } else {
106
-                    DB::connection()->rollBack();
107
-                }
108
-            }
109
-        }
99
+			if ($old_view->majgd_map === null) {
100
+				$this->migrateGeoAnalysisTable($old_view, $tree, $geoview_data_service);
101
+			} else {
102
+				DB::connection()->beginTransaction();
103
+				if ($this->migrateGeoAnalysisMap($old_view, $tree, $geoview_data_service)) {
104
+					DB::connection()->commit();
105
+				} else {
106
+					DB::connection()->rollBack();
107
+				}
108
+			}
109
+		}
110 110
 
111
-        $in_transaction = DB::connection()->getPdo()->inTransaction();
111
+		$in_transaction = DB::connection()->getPdo()->inTransaction();
112 112
 
113
-        DB::schema()->drop('maj_geodispersion');
113
+		DB::schema()->drop('maj_geodispersion');
114 114
 
115
-        if ($in_transaction && !DB::connection()->getPdo()->inTransaction()) {
116
-            DB::connection()->beginTransaction();
117
-        }
115
+		if ($in_transaction && !DB::connection()->getPdo()->inTransaction()) {
116
+			DB::connection()->beginTransaction();
117
+		}
118 118
 
119
-        FlashMessages::addMessage(I18N::translate(
120
-            'The geographical dispersion analyses have been migrated for webtrees 2. Please review their settings.'
121
-        ));
122
-    }
119
+		FlashMessages::addMessage(I18N::translate(
120
+			'The geographical dispersion analyses have been migrated for webtrees 2. Please review their settings.'
121
+		));
122
+	}
123 123
 
124
-    /**
125
-     * Create a Table geographical analysis view from a migrated item.
126
-     *
127
-     * @param stdClass $old_view
128
-     * @param Tree $tree
129
-     * @param GeoAnalysisViewDataService $geoview_data_service
130
-     * @return bool
131
-     */
132
-    private function migrateGeoAnalysisTable(
133
-        stdClass $old_view,
134
-        Tree $tree,
135
-        GeoAnalysisViewDataService $geoview_data_service
136
-    ): bool {
137
-        $new_view = new GeoAnalysisTable(
138
-            0,
139
-            $tree,
140
-            $old_view->majgd_status === 'enabled',
141
-            $old_view->majgd_descr,
142
-            app(SosaByGenerationGeoAnalysis::class),
143
-            (int) $old_view->majgd_sublevel,
144
-            (int) $old_view->majgd_detailsgen
145
-        );
124
+	/**
125
+	 * Create a Table geographical analysis view from a migrated item.
126
+	 *
127
+	 * @param stdClass $old_view
128
+	 * @param Tree $tree
129
+	 * @param GeoAnalysisViewDataService $geoview_data_service
130
+	 * @return bool
131
+	 */
132
+	private function migrateGeoAnalysisTable(
133
+		stdClass $old_view,
134
+		Tree $tree,
135
+		GeoAnalysisViewDataService $geoview_data_service
136
+	): bool {
137
+		$new_view = new GeoAnalysisTable(
138
+			0,
139
+			$tree,
140
+			$old_view->majgd_status === 'enabled',
141
+			$old_view->majgd_descr,
142
+			app(SosaByGenerationGeoAnalysis::class),
143
+			(int) $old_view->majgd_sublevel,
144
+			(int) $old_view->majgd_detailsgen
145
+		);
146 146
 
147
-        return $geoview_data_service->insertGetId($new_view) > 0;
148
-    }
147
+		return $geoview_data_service->insertGetId($new_view) > 0;
148
+	}
149 149
 
150
-    /**
151
-     * Create a Map geographical analysis view from a migrated item.
152
-     *
153
-     * @param stdClass $old_view
154
-     * @param Tree $tree
155
-     * @param GeoAnalysisViewDataService $geoview_data_service
156
-     * @return bool
157
-     */
158
-    private function migrateGeoAnalysisMap(
159
-        stdClass $old_view,
160
-        Tree $tree,
161
-        GeoAnalysisViewDataService $geoview_data_service
162
-    ): bool {
163
-        /** @var MapDefinitionsService $map_definition_service */
164
-        $map_definition_service = app(MapDefinitionsService::class);
165
-        /** @var MapAdapterDataService $mapadapter_data_service */
166
-        $mapadapter_data_service = app(MapAdapterDataService::class);
150
+	/**
151
+	 * Create a Map geographical analysis view from a migrated item.
152
+	 *
153
+	 * @param stdClass $old_view
154
+	 * @param Tree $tree
155
+	 * @param GeoAnalysisViewDataService $geoview_data_service
156
+	 * @return bool
157
+	 */
158
+	private function migrateGeoAnalysisMap(
159
+		stdClass $old_view,
160
+		Tree $tree,
161
+		GeoAnalysisViewDataService $geoview_data_service
162
+	): bool {
163
+		/** @var MapDefinitionsService $map_definition_service */
164
+		$map_definition_service = app(MapDefinitionsService::class);
165
+		/** @var MapAdapterDataService $mapadapter_data_service */
166
+		$mapadapter_data_service = app(MapAdapterDataService::class);
167 167
 
168
-        $new_view = new GeoAnalysisMap(
169
-            0,
170
-            $tree,
171
-            $old_view->majgd_status === 'enabled',
172
-            $old_view->majgd_descr,
173
-            app(SosaByGenerationGeoAnalysis::class),
174
-            (int) $old_view->majgd_sublevel,
175
-            (int) $old_view->majgd_detailsgen
176
-        );
168
+		$new_view = new GeoAnalysisMap(
169
+			0,
170
+			$tree,
171
+			$old_view->majgd_status === 'enabled',
172
+			$old_view->majgd_descr,
173
+			app(SosaByGenerationGeoAnalysis::class),
174
+			(int) $old_view->majgd_sublevel,
175
+			(int) $old_view->majgd_detailsgen
176
+		);
177 177
 
178
-        $view_id = $geoview_data_service->insertGetId($new_view);
179
-        if ($view_id === 0) {
180
-            return false;
181
-        }
182
-        $new_view = $new_view->withId($view_id);
178
+		$view_id = $geoview_data_service->insertGetId($new_view);
179
+		if ($view_id === 0) {
180
+			return false;
181
+		}
182
+		$new_view = $new_view->withId($view_id);
183 183
 
184
-        $colors = $new_view->colors();
185
-        foreach ($this->mapIdsFromOld($old_view->majgd_map) as $new_map_id) {
186
-            $map = $map_definition_service->find($new_map_id);
187
-            if ($map === null) {
188
-                return false;
189
-            }
190
-            $colors = $this->colorsFromMap($new_map_id);
184
+		$colors = $new_view->colors();
185
+		foreach ($this->mapIdsFromOld($old_view->majgd_map) as $new_map_id) {
186
+			$map = $map_definition_service->find($new_map_id);
187
+			if ($map === null) {
188
+				return false;
189
+			}
190
+			$colors = $this->colorsFromMap($new_map_id);
191 191
 
192
-            /** @var SimplePlaceMapper $mapper */
193
-            $mapper = app(SimplePlaceMapper::class);
194
-            $mapview_config = new MapViewConfig($this->mappingPropertyForMap($new_map_id), $mapper->config());
195
-            $map_adapter = new GeoAnalysisMapAdapter(0, $view_id, $map, $mapper, $mapview_config);
192
+			/** @var SimplePlaceMapper $mapper */
193
+			$mapper = app(SimplePlaceMapper::class);
194
+			$mapview_config = new MapViewConfig($this->mappingPropertyForMap($new_map_id), $mapper->config());
195
+			$map_adapter = new GeoAnalysisMapAdapter(0, $view_id, $map, $mapper, $mapview_config);
196 196
 
197
-            $mapadapter_data_service->insertGetId($map_adapter);
198
-        }
197
+			$mapadapter_data_service->insertGetId($map_adapter);
198
+		}
199 199
 
200
-        return $geoview_data_service->update($new_view->withColors($colors)) > 0;
201
-    }
200
+		return $geoview_data_service->update($new_view->withColors($colors)) > 0;
201
+	}
202 202
 
203
-    /**
204
-     * Get all new map definitions IDs representing an old map definition
205
-     *
206
-     * @param string $map_xml
207
-     * @return string[]
208
-     */
209
-    private function mapIdsFromOld(string $map_xml): array
210
-    {
211
-        $mapping = self::MAPS_XML_MAPPING[$map_xml] ?? [];
212
-        return is_array($mapping) ? $mapping : [ $mapping ];
213
-    }
203
+	/**
204
+	 * Get all new map definitions IDs representing an old map definition
205
+	 *
206
+	 * @param string $map_xml
207
+	 * @return string[]
208
+	 */
209
+	private function mapIdsFromOld(string $map_xml): array
210
+	{
211
+		$mapping = self::MAPS_XML_MAPPING[$map_xml] ?? [];
212
+		return is_array($mapping) ? $mapping : [ $mapping ];
213
+	}
214 214
 
215
-    /**
216
-     * Get the mapping property to be used for the migrated map adapter
217
-     *
218
-     * @param string $map_id
219
-     * @return string
220
-     */
221
-    private function mappingPropertyForMap(string $map_id): string
222
-    {
223
-        switch ($map_id) {
224
-            case 'fr-metropole-regions-1970':
225
-            case 'fr-metropole-regions-2016':
226
-                return 'region_insee_libelle';
227
-            case 'fr-metropole-departements':
228
-                return 'dpt_insee_libelle';
229
-            case 'fr-dpt-48-codespostaux':
230
-                return 'code_postal';
231
-            default:
232
-                return 'commune_insee_libelle';
233
-        }
234
-    }
215
+	/**
216
+	 * Get the mapping property to be used for the migrated map adapter
217
+	 *
218
+	 * @param string $map_id
219
+	 * @return string
220
+	 */
221
+	private function mappingPropertyForMap(string $map_id): string
222
+	{
223
+		switch ($map_id) {
224
+			case 'fr-metropole-regions-1970':
225
+			case 'fr-metropole-regions-2016':
226
+				return 'region_insee_libelle';
227
+			case 'fr-metropole-departements':
228
+				return 'dpt_insee_libelle';
229
+			case 'fr-dpt-48-codespostaux':
230
+				return 'code_postal';
231
+			default:
232
+				return 'commune_insee_libelle';
233
+		}
234
+	}
235 235
 
236
-    /**
237
-     * Get the color configuration to be used for the migrated map view
238
-     *
239
-     * @param string $map_id
240
-     * @return MapColorsConfig
241
-     */
242
-    private function colorsFromMap(string $map_id): MapColorsConfig
243
-    {
244
-        $default = Hex::fromString('#f5f5f5');
245
-        $stroke = Hex::fromString('#d5d5d5');
246
-        $hover = Hex::fromString('#ff6600');
236
+	/**
237
+	 * Get the color configuration to be used for the migrated map view
238
+	 *
239
+	 * @param string $map_id
240
+	 * @return MapColorsConfig
241
+	 */
242
+	private function colorsFromMap(string $map_id): MapColorsConfig
243
+	{
244
+		$default = Hex::fromString('#f5f5f5');
245
+		$stroke = Hex::fromString('#d5d5d5');
246
+		$hover = Hex::fromString('#ff6600');
247 247
 
248
-        switch ($map_id) {
249
-            case 'fr-metropole-departements':
250
-                return new MapColorsConfig($default, $stroke, Hex::fromString('#0493ab'), $hover);
251
-            case 'fr-dpt-48-codespostaux':
252
-                return new MapColorsConfig($default, $stroke, Hex::fromString('#44aa00'), $hover);
253
-            default:
254
-                return new MapColorsConfig($default, $stroke, Hex::fromString('#e2a61d'), $hover);
255
-        }
256
-    }
248
+		switch ($map_id) {
249
+			case 'fr-metropole-departements':
250
+				return new MapColorsConfig($default, $stroke, Hex::fromString('#0493ab'), $hover);
251
+			case 'fr-dpt-48-codespostaux':
252
+				return new MapColorsConfig($default, $stroke, Hex::fromString('#44aa00'), $hover);
253
+			default:
254
+				return new MapColorsConfig($default, $stroke, Hex::fromString('#e2a61d'), $hover);
255
+		}
256
+	}
257 257
 }
Please login to merge, or discard this patch.
app/Module/GeoDispersion/Schema/Migration1.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -23,41 +23,41 @@
 block discarded – undo
23 23
  */
24 24
 class Migration1 implements MigrationInterface
25 25
 {
26
-    /**
27
-     * {@inheritDoc}
28
-     * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade()
29
-     */
30
-    public function upgrade(): void
31
-    {
32
-        $in_transaction = DB::connection()->getPdo()->inTransaction();
33
-
34
-        DB::schema()->create('maj_geodisp_views', static function (Blueprint $table): void {
35
-            $table->integer('majgv_id')->autoIncrement();
36
-            $table->integer('majgv_gedcom_id')->index();
37
-            $table->string('majgv_view_class', 255);
38
-            $table->enum('majgv_status', ['enabled', 'disabled'])->default('enabled');
39
-            $table->string('majgv_descr', 248);
40
-            $table->string('majgv_analysis', 255);
41
-            $table->tinyInteger('majgv_place_depth')->default(1);
42
-            $table->tinyInteger('majgv_top_places')->default(0);
43
-            $table->json('majgv_colors')->nullable();
44
-
45
-            $table->foreign('majgv_gedcom_id')->references('gedcom_id')->on('gedcom')->onDelete('cascade');
46
-        });
47
-
48
-        DB::schema()->create('maj_geodisp_mapviews', static function (Blueprint $table): void {
49
-            $table->integer('majgm_id')->autoIncrement();
50
-            $table->integer('majgm_majgv_id')->index();
51
-            $table->string('majgm_map_id', 127);
52
-            $table->string('majgm_mapper', 255);
53
-            $table->string('majgm_feature_prop', 31);
54
-            $table->json('majgm_config')->nullable();
55
-
56
-            $table->foreign('majgm_majgv_id')->references('majgv_id')->on('maj_geodisp_views')->onDelete('cascade');
57
-        });
58
-
59
-        if ($in_transaction && !DB::connection()->getPdo()->inTransaction()) {
60
-            DB::connection()->beginTransaction();
61
-        }
62
-    }
26
+	/**
27
+	 * {@inheritDoc}
28
+	 * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade()
29
+	 */
30
+	public function upgrade(): void
31
+	{
32
+		$in_transaction = DB::connection()->getPdo()->inTransaction();
33
+
34
+		DB::schema()->create('maj_geodisp_views', static function (Blueprint $table): void {
35
+			$table->integer('majgv_id')->autoIncrement();
36
+			$table->integer('majgv_gedcom_id')->index();
37
+			$table->string('majgv_view_class', 255);
38
+			$table->enum('majgv_status', ['enabled', 'disabled'])->default('enabled');
39
+			$table->string('majgv_descr', 248);
40
+			$table->string('majgv_analysis', 255);
41
+			$table->tinyInteger('majgv_place_depth')->default(1);
42
+			$table->tinyInteger('majgv_top_places')->default(0);
43
+			$table->json('majgv_colors')->nullable();
44
+
45
+			$table->foreign('majgv_gedcom_id')->references('gedcom_id')->on('gedcom')->onDelete('cascade');
46
+		});
47
+
48
+		DB::schema()->create('maj_geodisp_mapviews', static function (Blueprint $table): void {
49
+			$table->integer('majgm_id')->autoIncrement();
50
+			$table->integer('majgm_majgv_id')->index();
51
+			$table->string('majgm_map_id', 127);
52
+			$table->string('majgm_mapper', 255);
53
+			$table->string('majgm_feature_prop', 31);
54
+			$table->json('majgm_config')->nullable();
55
+
56
+			$table->foreign('majgm_majgv_id')->references('majgv_id')->on('maj_geodisp_views')->onDelete('cascade');
57
+		});
58
+
59
+		if ($in_transaction && !DB::connection()->getPdo()->inTransaction()) {
60
+			DB::connection()->beginTransaction();
61
+		}
62
+	}
63 63
 }
Please login to merge, or discard this patch.
app/Module/GeoDispersion/Http/RequestHandlers/GeoAnalysisViewAddPage.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -32,48 +32,48 @@
 block discarded – undo
32 32
  */
33 33
 class GeoAnalysisViewAddPage implements RequestHandlerInterface
34 34
 {
35
-    use ViewResponseTrait;
35
+	use ViewResponseTrait;
36 36
 
37
-    private ?GeoDispersionModule $module;
38
-    private GeoAnalysisService $geoanalysis_service;
39
-    private GeoAnalysisDataService $geoanalysis_data_service;
37
+	private ?GeoDispersionModule $module;
38
+	private GeoAnalysisService $geoanalysis_service;
39
+	private GeoAnalysisDataService $geoanalysis_data_service;
40 40
 
41
-    /**
42
-     * Constructor for GeoAnalysisViewAddPage Request Handler
43
-     *
44
-     * @param ModuleService $module_service
45
-     * @param GeoAnalysisService $geoanalysis_service
46
-     * @param GeoAnalysisDataService $geoanalysis_data_service
47
-     */
48
-    public function __construct(
49
-        ModuleService $module_service,
50
-        GeoAnalysisService $geoanalysis_service,
51
-        GeoAnalysisDataService $geoanalysis_data_service
52
-    ) {
53
-        $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
54
-        $this->geoanalysis_service = $geoanalysis_service;
55
-        $this->geoanalysis_data_service = $geoanalysis_data_service;
56
-    }
41
+	/**
42
+	 * Constructor for GeoAnalysisViewAddPage Request Handler
43
+	 *
44
+	 * @param ModuleService $module_service
45
+	 * @param GeoAnalysisService $geoanalysis_service
46
+	 * @param GeoAnalysisDataService $geoanalysis_data_service
47
+	 */
48
+	public function __construct(
49
+		ModuleService $module_service,
50
+		GeoAnalysisService $geoanalysis_service,
51
+		GeoAnalysisDataService $geoanalysis_data_service
52
+	) {
53
+		$this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
54
+		$this->geoanalysis_service = $geoanalysis_service;
55
+		$this->geoanalysis_data_service = $geoanalysis_data_service;
56
+	}
57 57
 
58
-    /**
59
-     * {@inheritDoc}
60
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
61
-     */
62
-    public function handle(ServerRequestInterface $request): ResponseInterface
63
-    {
64
-        $this->layout = 'layouts/administration';
58
+	/**
59
+	 * {@inheritDoc}
60
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
61
+	 */
62
+	public function handle(ServerRequestInterface $request): ResponseInterface
63
+	{
64
+		$this->layout = 'layouts/administration';
65 65
 
66
-        if ($this->module === null) {
67
-            throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
68
-        }
69
-        $tree = Validator::attributes($request)->tree();
66
+		if ($this->module === null) {
67
+			throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
68
+		}
69
+		$tree = Validator::attributes($request)->tree();
70 70
 
71
-        return $this->viewResponse($this->module->name() . '::admin/view-add', [
72
-            'module'        =>  $this->module,
73
-            'title'         =>  I18N::translate('Add a geographical dispersion analysis view'),
74
-            'tree'          =>  $tree,
75
-            'geoanalysis_list'  =>  $this->geoanalysis_service->all(),
76
-            'place_example'     =>  $this->geoanalysis_data_service->placeHierarchyExample($tree)
77
-        ]);
78
-    }
71
+		return $this->viewResponse($this->module->name() . '::admin/view-add', [
72
+			'module'        =>  $this->module,
73
+			'title'         =>  I18N::translate('Add a geographical dispersion analysis view'),
74
+			'tree'          =>  $tree,
75
+			'geoanalysis_list'  =>  $this->geoanalysis_service->all(),
76
+			'place_example'     =>  $this->geoanalysis_data_service->placeHierarchyExample($tree)
77
+		]);
78
+	}
79 79
 }
Please login to merge, or discard this patch.
app/Module/GeoDispersion/Http/RequestHandlers/MapAdapterEditPage.php 1 patch
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 MapAdapterEditPage implements RequestHandlerInterface
35 35
 {
36
-    use ViewResponseTrait;
36
+	use ViewResponseTrait;
37 37
 
38
-    private ?GeoDispersionModule $module;
39
-    private MapAdapterDataService $mapadapter_data_service;
40
-    private MapDefinitionsService $map_definition_service;
41
-    private PlaceMapperService $place_mapper_service;
38
+	private ?GeoDispersionModule $module;
39
+	private MapAdapterDataService $mapadapter_data_service;
40
+	private MapDefinitionsService $map_definition_service;
41
+	private PlaceMapperService $place_mapper_service;
42 42
 
43
-    /**
44
-     * Constructor for MapAdapterEditPage Request Handler
45
-     *
46
-     * @param ModuleService $module_service
47
-     * @param MapAdapterDataService $mapadapter_data_service
48
-     * @param MapDefinitionsService $map_definition_service
49
-     * @param PlaceMapperService $place_mapper_service
50
-     */
51
-    public function __construct(
52
-        ModuleService $module_service,
53
-        MapAdapterDataService $mapadapter_data_service,
54
-        MapDefinitionsService $map_definition_service,
55
-        PlaceMapperService $place_mapper_service
56
-    ) {
57
-        $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
58
-        $this->mapadapter_data_service = $mapadapter_data_service;
59
-        $this->map_definition_service = $map_definition_service;
60
-        $this->place_mapper_service = $place_mapper_service;
61
-    }
43
+	/**
44
+	 * Constructor for MapAdapterEditPage Request Handler
45
+	 *
46
+	 * @param ModuleService $module_service
47
+	 * @param MapAdapterDataService $mapadapter_data_service
48
+	 * @param MapDefinitionsService $map_definition_service
49
+	 * @param PlaceMapperService $place_mapper_service
50
+	 */
51
+	public function __construct(
52
+		ModuleService $module_service,
53
+		MapAdapterDataService $mapadapter_data_service,
54
+		MapDefinitionsService $map_definition_service,
55
+		PlaceMapperService $place_mapper_service
56
+	) {
57
+		$this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
58
+		$this->mapadapter_data_service = $mapadapter_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
-        $adapter_id = Validator::attributes($request)->integer('adapter_id', -1);
78
-        $map_adapter = $this->mapadapter_data_service->find($adapter_id);
77
+		$adapter_id = Validator::attributes($request)->integer('adapter_id', -1);
78
+		$map_adapter = $this->mapadapter_data_service->find($adapter_id);
79 79
 
80
-        if ($map_adapter === null) {
81
-            throw new HttpNotFoundException(
82
-                I18N::translate('The map configuration could not be found.')
83
-            );
84
-        }
80
+		if ($map_adapter === null) {
81
+			throw new HttpNotFoundException(
82
+				I18N::translate('The map configuration 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('Edit the map configuration'),
89
-            'tree'              =>  $tree,
90
-            'view_id'           =>  $map_adapter->geoAnalysisViewId(),
91
-            'map_adapter'       =>  $map_adapter,
92
-            'maps_list'         =>  $this->map_definition_service->all(),
93
-            'mappers_list'      =>  $this->place_mapper_service->all(),
94
-            'route_edit'        =>  route(MapAdapterEditAction::class, [
95
-                                        'tree' => $tree->name(),
96
-                                        'adapter_id' => $map_adapter->id()
97
-                                    ])
98
-        ]);
99
-    }
86
+		return $this->viewResponse($this->module->name() . '::admin/map-adapter-edit', [
87
+			'module'            =>  $this->module,
88
+			'title'             =>  I18N::translate('Edit the map configuration'),
89
+			'tree'              =>  $tree,
90
+			'view_id'           =>  $map_adapter->geoAnalysisViewId(),
91
+			'map_adapter'       =>  $map_adapter,
92
+			'maps_list'         =>  $this->map_definition_service->all(),
93
+			'mappers_list'      =>  $this->place_mapper_service->all(),
94
+			'route_edit'        =>  route(MapAdapterEditAction::class, [
95
+										'tree' => $tree->name(),
96
+										'adapter_id' => $map_adapter->id()
97
+									])
98
+		]);
99
+	}
100 100
 }
Please login to merge, or discard this patch.
app/Module/GeoDispersion/Http/RequestHandlers/AdminConfigPage.php 1 patch
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -35,64 +35,64 @@
 block discarded – undo
35 35
  */
36 36
 class AdminConfigPage implements RequestHandlerInterface
37 37
 {
38
-    use ViewResponseTrait;
39
-
40
-    private ?GeoDispersionModule $module;
41
-
42
-    private TreeService $tree_service;
43
-
44
-    private GeoAnalysisDataService $geoanalysis_data_service;
45
-
46
-    /**
47
-     * Constructor for the AdminConfigPage Request Handler
48
-     *
49
-     * @param ModuleService $module_service
50
-     * @param TreeService $tree_service
51
-     * @param GeoAnalysisDataService $geoanalysis_data_service
52
-     */
53
-    public function __construct(
54
-        ModuleService $module_service,
55
-        TreeService $tree_service,
56
-        GeoAnalysisDataService $geoanalysis_data_service
57
-    ) {
58
-        $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
59
-        $this->tree_service = $tree_service;
60
-        $this->geoanalysis_data_service = $geoanalysis_data_service;
61
-    }
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';
70
-
71
-        if ($this->module === null) {
72
-            throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
73
-        }
74
-
75
-        $user = Validator::attributes($request)->user();
76
-
77
-        $all_trees = $this->tree_service->all()->filter(fn(Tree $tree) => Auth::isManager($tree, $user));
78
-        if ($all_trees->count() === 0) {
79
-            throw new HttpAccessDeniedException();
80
-        }
81
-
82
-        $tree = Validator::attributes($request)->treeOptional() ?? $all_trees->first();
83
-
84
-        $same_tree = fn(Tree $tree_collection): bool => $tree->id() === $tree_collection->id();
85
-        if (!$all_trees->contains($same_tree)) {
86
-            throw new HttpAccessDeniedException();
87
-        }
88
-
89
-        return $this->viewResponse($this->module->name() . '::admin/config', [
90
-            'module_name'       =>  $this->module->name(),
91
-            'title'             =>  $this->module->title(),
92
-            'tree'              =>  $tree,
93
-            'other_trees'       =>  $all_trees->reject($same_tree),
94
-            'place_example'     =>  $this->geoanalysis_data_service->placeHierarchyExample($tree),
95
-            'js_script_url'     =>  $this->module->assetUrl('js/geodispersion.min.js')
96
-        ]);
97
-    }
38
+	use ViewResponseTrait;
39
+
40
+	private ?GeoDispersionModule $module;
41
+
42
+	private TreeService $tree_service;
43
+
44
+	private GeoAnalysisDataService $geoanalysis_data_service;
45
+
46
+	/**
47
+	 * Constructor for the AdminConfigPage Request Handler
48
+	 *
49
+	 * @param ModuleService $module_service
50
+	 * @param TreeService $tree_service
51
+	 * @param GeoAnalysisDataService $geoanalysis_data_service
52
+	 */
53
+	public function __construct(
54
+		ModuleService $module_service,
55
+		TreeService $tree_service,
56
+		GeoAnalysisDataService $geoanalysis_data_service
57
+	) {
58
+		$this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
59
+		$this->tree_service = $tree_service;
60
+		$this->geoanalysis_data_service = $geoanalysis_data_service;
61
+	}
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';
70
+
71
+		if ($this->module === null) {
72
+			throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
73
+		}
74
+
75
+		$user = Validator::attributes($request)->user();
76
+
77
+		$all_trees = $this->tree_service->all()->filter(fn(Tree $tree) => Auth::isManager($tree, $user));
78
+		if ($all_trees->count() === 0) {
79
+			throw new HttpAccessDeniedException();
80
+		}
81
+
82
+		$tree = Validator::attributes($request)->treeOptional() ?? $all_trees->first();
83
+
84
+		$same_tree = fn(Tree $tree_collection): bool => $tree->id() === $tree_collection->id();
85
+		if (!$all_trees->contains($same_tree)) {
86
+			throw new HttpAccessDeniedException();
87
+		}
88
+
89
+		return $this->viewResponse($this->module->name() . '::admin/config', [
90
+			'module_name'       =>  $this->module->name(),
91
+			'title'             =>  $this->module->title(),
92
+			'tree'              =>  $tree,
93
+			'other_trees'       =>  $all_trees->reject($same_tree),
94
+			'place_example'     =>  $this->geoanalysis_data_service->placeHierarchyExample($tree),
95
+			'js_script_url'     =>  $this->module->assetUrl('js/geodispersion.min.js')
96
+		]);
97
+	}
98 98
 }
Please login to merge, or discard this patch.