Passed
Push — feature/code-analysis ( 60fe63...00c5b4 )
by Jonathan
11:49
created
app/Module/GeoDispersion/Http/RequestHandlers/GeoAnalysisViewTabs.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -31,58 +31,58 @@
 block discarded – undo
31 31
  */
32 32
 class GeoAnalysisViewTabs implements RequestHandlerInterface
33 33
 {
34
-    private ?GeoDispersionModule $module;
35
-    private GeoAnalysisViewDataService $geoviewdata_service;
34
+	private ?GeoDispersionModule $module;
35
+	private GeoAnalysisViewDataService $geoviewdata_service;
36 36
 
37
-    /**
38
-     * Constructor for GeoAnalysisMapsList Request Handler
39
-     *
40
-     * @param ModuleService $module_service
41
-     */
42
-    public function __construct(
43
-        ModuleService $module_service,
44
-        GeoAnalysisViewDataService $geoviewdata_service
45
-    ) {
46
-        $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
47
-        $this->geoviewdata_service = $geoviewdata_service;
48
-    }
37
+	/**
38
+	 * Constructor for GeoAnalysisMapsList Request Handler
39
+	 *
40
+	 * @param ModuleService $module_service
41
+	 */
42
+	public function __construct(
43
+		ModuleService $module_service,
44
+		GeoAnalysisViewDataService $geoviewdata_service
45
+	) {
46
+		$this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
47
+		$this->geoviewdata_service = $geoviewdata_service;
48
+	}
49 49
 
50
-    /**
51
-     * {@inheritDoc}
52
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
53
-     */
54
-    public function handle(ServerRequestInterface $request): ResponseInterface
55
-    {
56
-        if ($this->module === null) {
57
-            throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
58
-        }
50
+	/**
51
+	 * {@inheritDoc}
52
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
53
+	 */
54
+	public function handle(ServerRequestInterface $request): ResponseInterface
55
+	{
56
+		if ($this->module === null) {
57
+			throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
58
+		}
59 59
 
60
-        $tree = Validator::attributes($request)->tree();
61
-        $view_id = Validator::attributes($request)->integer('view_id', -1);
60
+		$tree = Validator::attributes($request)->tree();
61
+		$view_id = Validator::attributes($request)->integer('view_id', -1);
62 62
 
63
-        $view = $this->geoviewdata_service->find($tree, $view_id);
63
+		$view = $this->geoviewdata_service->find($tree, $view_id);
64 64
 
65
-        if ($view === null) {
66
-            throw new HttpNotFoundException(I18N::translate('The requested dispersion analysis does not exist.'));
67
-        }
65
+		if ($view === null) {
66
+			throw new HttpNotFoundException(I18N::translate('The requested dispersion analysis does not exist.'));
67
+		}
68 68
 
69
-        $results = $view->analysis()->results($tree, $view->placesDepth());
69
+		$results = $view->analysis()->results($tree, $view->placesDepth());
70 70
 
71
-        $params = [
72
-            'module_name'   =>  $this->module->name(),
73
-            'tree'          =>  $tree,
74
-            'view'          =>  $view,
75
-            'items_descr'   =>  $view->analysis()->itemsDescription()
76
-        ];
77
-        $response = [
78
-            'global'    =>  view('layouts/ajax', [
79
-                'content' =>    $view->globalTabContent($this->module, $results->global(), $params)
80
-            ]),
81
-            'detailed'  => view('layouts/ajax', [
82
-                'content' =>    $view->detailedTabContent($this->module, $results->sortedDetailed(), $params)
83
-            ])
84
-        ];
71
+		$params = [
72
+			'module_name'   =>  $this->module->name(),
73
+			'tree'          =>  $tree,
74
+			'view'          =>  $view,
75
+			'items_descr'   =>  $view->analysis()->itemsDescription()
76
+		];
77
+		$response = [
78
+			'global'    =>  view('layouts/ajax', [
79
+				'content' =>    $view->globalTabContent($this->module, $results->global(), $params)
80
+			]),
81
+			'detailed'  => view('layouts/ajax', [
82
+				'content' =>    $view->detailedTabContent($this->module, $results->sortedDetailed(), $params)
83
+			])
84
+		];
85 85
 
86
-        return Registry::responseFactory()->response($response);
87
-    }
86
+		return Registry::responseFactory()->response($response);
87
+	}
88 88
 }
Please login to merge, or discard this patch.
Module/GeoDispersion/Http/RequestHandlers/GeoAnalysisViewStatusAction.php 2 patches
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -32,65 +32,65 @@
 block discarded – undo
32 32
  */
33 33
 class GeoAnalysisViewStatusAction implements RequestHandlerInterface
34 34
 {
35
-    private ?GeoDispersionModule $module;
36
-    private GeoAnalysisViewDataService $geoview_data_service;
35
+	private ?GeoDispersionModule $module;
36
+	private GeoAnalysisViewDataService $geoview_data_service;
37 37
 
38
-    /**
39
-     * Constructor for GeoAnalysisViewStatusAction Request Handler
40
-     *
41
-     * @param ModuleService $module_service
42
-     * @param GeoAnalysisViewDataService $geoview_data_service
43
-     */
44
-    public function __construct(ModuleService $module_service, GeoAnalysisViewDataService $geoview_data_service)
45
-    {
46
-        $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
47
-        $this->geoview_data_service = $geoview_data_service;
48
-    }
38
+	/**
39
+	 * Constructor for GeoAnalysisViewStatusAction Request Handler
40
+	 *
41
+	 * @param ModuleService $module_service
42
+	 * @param GeoAnalysisViewDataService $geoview_data_service
43
+	 */
44
+	public function __construct(ModuleService $module_service, GeoAnalysisViewDataService $geoview_data_service)
45
+	{
46
+		$this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
47
+		$this->geoview_data_service = $geoview_data_service;
48
+	}
49 49
 
50
-    /**
51
-     * {@inheritDoc}
52
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
53
-     */
54
-    public function handle(ServerRequestInterface $request): ResponseInterface
55
-    {
56
-        $tree = Validator::attributes($request)->tree();
50
+	/**
51
+	 * {@inheritDoc}
52
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
53
+	 */
54
+	public function handle(ServerRequestInterface $request): ResponseInterface
55
+	{
56
+		$tree = Validator::attributes($request)->tree();
57 57
 
58
-        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(AdminConfigPage::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(AdminConfigPage::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
-        try {
78
-            $this->geoview_data_service->updateStatus($view, Validator::attributes($request)->boolean('enable', false));
79
-            FlashMessages::addMessage(
80
-                I18N::translate('The geographical dispersion analysis view has been successfully updated.'),
81
-                'success'
82
-            );
83
-            //phpcs:ignore Generic.Files.LineLength.TooLong
84
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been updated.');
85
-        } catch (Throwable $ex) {
86
-            FlashMessages::addMessage(
87
-                I18N::translate('An error occured while updating the geographical dispersion analysis view.'),
88
-                'danger'
89
-            );
90
-            //phpcs:ignore Generic.Files.LineLength.TooLong
91
-            Log::addErrorLog('Module ' . $this->module->title() . ' : Error when updating view “' . $view->id() . '”: ' . $ex->getMessage());
92
-        }
77
+		try {
78
+			$this->geoview_data_service->updateStatus($view, Validator::attributes($request)->boolean('enable', false));
79
+			FlashMessages::addMessage(
80
+				I18N::translate('The geographical dispersion analysis view has been successfully updated.'),
81
+				'success'
82
+			);
83
+			//phpcs:ignore Generic.Files.LineLength.TooLong
84
+			Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been updated.');
85
+		} catch (Throwable $ex) {
86
+			FlashMessages::addMessage(
87
+				I18N::translate('An error occured while updating the geographical dispersion analysis view.'),
88
+				'danger'
89
+			);
90
+			//phpcs:ignore Generic.Files.LineLength.TooLong
91
+			Log::addErrorLog('Module ' . $this->module->title() . ' : Error when updating view “' . $view->id() . '”: ' . $ex->getMessage());
92
+		}
93 93
 
94
-        return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
95
-    }
94
+		return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
95
+	}
96 96
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -81,14 +81,14 @@
 block discarded – undo
81 81
                 'success'
82 82
             );
83 83
             //phpcs:ignore Generic.Files.LineLength.TooLong
84
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been updated.');
84
+            Log::addConfigurationLog('Module '.$this->module->title().' : View “'.$view->id().'” has been updated.');
85 85
         } catch (Throwable $ex) {
86 86
             FlashMessages::addMessage(
87 87
                 I18N::translate('An error occured while updating the geographical dispersion analysis view.'),
88 88
                 'danger'
89 89
             );
90 90
             //phpcs:ignore Generic.Files.LineLength.TooLong
91
-            Log::addErrorLog('Module ' . $this->module->title() . ' : Error when updating view “' . $view->id() . '”: ' . $ex->getMessage());
91
+            Log::addErrorLog('Module '.$this->module->title().' : Error when updating view “'.$view->id().'”: '.$ex->getMessage());
92 92
         }
93 93
 
94 94
         return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
Please login to merge, or discard this patch.
app/Module/GeoDispersion/Http/RequestHandlers/MapAdapterDeleteAction.php 2 patches
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -31,67 +31,67 @@
 block discarded – undo
31 31
  */
32 32
 class MapAdapterDeleteAction implements RequestHandlerInterface
33 33
 {
34
-    private ?GeoDispersionModule $module;
35
-    private MapAdapterDataService $mapadapter_data_service;
34
+	private ?GeoDispersionModule $module;
35
+	private MapAdapterDataService $mapadapter_data_service;
36 36
 
37
-    /**
38
-     * Constructor for MapAdapterDeleteAction Request Handler
39
-     *
40
-     * @param ModuleService $module_service
41
-     * @param MapAdapterDataService $mapadapter_data_service
42
-     */
43
-    public function __construct(ModuleService $module_service, MapAdapterDataService $mapadapter_data_service)
44
-    {
45
-        $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
46
-        $this->mapadapter_data_service = $mapadapter_data_service;
47
-    }
37
+	/**
38
+	 * Constructor for MapAdapterDeleteAction Request Handler
39
+	 *
40
+	 * @param ModuleService $module_service
41
+	 * @param MapAdapterDataService $mapadapter_data_service
42
+	 */
43
+	public function __construct(ModuleService $module_service, MapAdapterDataService $mapadapter_data_service)
44
+	{
45
+		$this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
46
+		$this->mapadapter_data_service = $mapadapter_data_service;
47
+	}
48 48
 
49
-    /**
50
-     * {@inheritDoc}
51
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
52
-     */
53
-    public function handle(ServerRequestInterface $request): ResponseInterface
54
-    {
55
-        $tree = Validator::attributes($request)->tree();
49
+	/**
50
+	 * {@inheritDoc}
51
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
52
+	 */
53
+	public function handle(ServerRequestInterface $request): ResponseInterface
54
+	{
55
+		$tree = Validator::attributes($request)->tree();
56 56
 
57
-        if ($this->module === null) {
58
-            FlashMessages::addMessage(
59
-                I18N::translate('The attached module could not be found.'),
60
-                'danger'
61
-            );
62
-            return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
63
-        }
57
+		if ($this->module === null) {
58
+			FlashMessages::addMessage(
59
+				I18N::translate('The attached module could not be found.'),
60
+				'danger'
61
+			);
62
+			return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
63
+		}
64 64
 
65
-        $adapter_id = Validator::attributes($request)->integer('adapter_id', -1);
66
-        $map_adapter = $this->mapadapter_data_service->find($adapter_id);
65
+		$adapter_id = Validator::attributes($request)->integer('adapter_id', -1);
66
+		$map_adapter = $this->mapadapter_data_service->find($adapter_id);
67 67
 
68
-        if ($map_adapter === null) {
69
-            FlashMessages::addMessage(
70
-                I18N::translate('The map configuration with ID “%d” does not exist.', I18N::number($adapter_id)),
71
-                'danger'
72
-            );
73
-            return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
74
-        }
68
+		if ($map_adapter === null) {
69
+			FlashMessages::addMessage(
70
+				I18N::translate('The map configuration with ID “%d” does not exist.', I18N::number($adapter_id)),
71
+				'danger'
72
+			);
73
+			return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
74
+		}
75 75
 
76
-        if ($this->mapadapter_data_service->delete($map_adapter) > 0) {
77
-            FlashMessages::addMessage(
78
-                I18N::translate('The map configuration has been successfully deleted.'),
79
-                'success'
80
-            );
81
-            //phpcs:ignore Generic.Files.LineLength.TooLong
82
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $map_adapter->id() . '” has been deleted.');
83
-        } else {
84
-            FlashMessages::addMessage(
85
-                I18N::translate('An error occured while deleting the map configuration.'),
86
-                'danger'
87
-            );
88
-            //phpcs:ignore Generic.Files.LineLength.TooLong
89
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $map_adapter->id() . '” could not be deleted. See error log.');
90
-        }
76
+		if ($this->mapadapter_data_service->delete($map_adapter) > 0) {
77
+			FlashMessages::addMessage(
78
+				I18N::translate('The map configuration has been successfully deleted.'),
79
+				'success'
80
+			);
81
+			//phpcs:ignore Generic.Files.LineLength.TooLong
82
+			Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $map_adapter->id() . '” has been deleted.');
83
+		} else {
84
+			FlashMessages::addMessage(
85
+				I18N::translate('An error occured while deleting the map configuration.'),
86
+				'danger'
87
+			);
88
+			//phpcs:ignore Generic.Files.LineLength.TooLong
89
+			Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $map_adapter->id() . '” could not be deleted. See error log.');
90
+		}
91 91
 
92
-        return Registry::responseFactory()->redirect(GeoAnalysisViewEditPage::class, [
93
-            'tree'      => $tree->name(),
94
-            'view_id'   => $map_adapter->geoAnalysisViewId()
95
-        ]);
96
-    }
92
+		return Registry::responseFactory()->redirect(GeoAnalysisViewEditPage::class, [
93
+			'tree'      => $tree->name(),
94
+			'view_id'   => $map_adapter->geoAnalysisViewId()
95
+		]);
96
+	}
97 97
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,14 +79,14 @@
 block discarded – undo
79 79
                 'success'
80 80
             );
81 81
             //phpcs:ignore Generic.Files.LineLength.TooLong
82
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $map_adapter->id() . '” has been deleted.');
82
+            Log::addConfigurationLog('Module '.$this->module->title().' : Map Adapter “'.$map_adapter->id().'” has been deleted.');
83 83
         } else {
84 84
             FlashMessages::addMessage(
85 85
                 I18N::translate('An error occured while deleting the map configuration.'),
86 86
                 'danger'
87 87
             );
88 88
             //phpcs:ignore Generic.Files.LineLength.TooLong
89
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $map_adapter->id() . '” could not be deleted. See error log.');
89
+            Log::addConfigurationLog('Module '.$this->module->title().' : Map Adapter “'.$map_adapter->id().'” could not be deleted. See error log.');
90 90
         }
91 91
 
92 92
         return Registry::responseFactory()->redirect(GeoAnalysisViewEditPage::class, [
Please login to merge, or discard this patch.
app/Module/GeoDispersion/Http/RequestHandlers/GeoAnalysisViewAddAction.php 2 patches
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -36,81 +36,81 @@
 block discarded – undo
36 36
  */
37 37
 class GeoAnalysisViewAddAction implements RequestHandlerInterface
38 38
 {
39
-    private ?GeoDispersionModule $module;
40
-    private GeoAnalysisViewDataService $geoview_data_service;
39
+	private ?GeoDispersionModule $module;
40
+	private GeoAnalysisViewDataService $geoview_data_service;
41 41
 
42
-    /**
43
-     * Constructor for GeoAnalysisViewAddAction Request Handler
44
-     *
45
-     * @param ModuleService $module_service
46
-     * @param GeoAnalysisViewDataService $geoview_data_service
47
-     */
48
-    public function __construct(ModuleService $module_service, GeoAnalysisViewDataService $geoview_data_service)
49
-    {
50
-        $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
51
-        $this->geoview_data_service = $geoview_data_service;
52
-    }
42
+	/**
43
+	 * Constructor for GeoAnalysisViewAddAction Request Handler
44
+	 *
45
+	 * @param ModuleService $module_service
46
+	 * @param GeoAnalysisViewDataService $geoview_data_service
47
+	 */
48
+	public function __construct(ModuleService $module_service, GeoAnalysisViewDataService $geoview_data_service)
49
+	{
50
+		$this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
51
+		$this->geoview_data_service = $geoview_data_service;
52
+	}
53 53
 
54
-    /**
55
-     * {@inheritDoc}
56
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
57
-     */
58
-    public function handle(ServerRequestInterface $request): ResponseInterface
59
-    {
60
-        $tree = Validator::attributes($request)->tree();
54
+	/**
55
+	 * {@inheritDoc}
56
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
57
+	 */
58
+	public function handle(ServerRequestInterface $request): ResponseInterface
59
+	{
60
+		$tree = Validator::attributes($request)->tree();
61 61
 
62
-        if ($this->module === null) {
63
-            FlashMessages::addMessage(
64
-                I18N::translate('The attached module could not be found.'),
65
-                'danger'
66
-            );
67
-            return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
68
-        }
62
+		if ($this->module === null) {
63
+			FlashMessages::addMessage(
64
+				I18N::translate('The attached module could not be found.'),
65
+				'danger'
66
+			);
67
+			return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
68
+		}
69 69
 
70
-        $type           = Validator::parsedBody($request)->isInArray(['table', 'map'])->string('view_type', '');
71
-        $description    = Validator::parsedBody($request)->string('view_description', '');
72
-        $place_depth    = Validator::parsedBody($request)->integer('view_depth', 1);
70
+		$type           = Validator::parsedBody($request)->isInArray(['table', 'map'])->string('view_type', '');
71
+		$description    = Validator::parsedBody($request)->string('view_description', '');
72
+		$place_depth    = Validator::parsedBody($request)->integer('view_depth', 1);
73 73
 
74
-        $analysis = null;
75
-        try {
76
-            $analysis = app(Validator::parsedBody($request)->string('view_analysis', ''));
77
-        } catch (BindingResolutionException $ex) {
78
-        }
74
+		$analysis = null;
75
+		try {
76
+			$analysis = app(Validator::parsedBody($request)->string('view_analysis', ''));
77
+		} catch (BindingResolutionException $ex) {
78
+		}
79 79
 
80
-        if ($type === '' || $place_depth <= 0 || $analysis === null || !($analysis instanceof GeoAnalysisInterface)) {
81
-            FlashMessages::addMessage(
82
-                I18N::translate('The parameters for the new view are not valid.'),
83
-                'danger'
84
-            );
85
-            return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
86
-        }
80
+		if ($type === '' || $place_depth <= 0 || $analysis === null || !($analysis instanceof GeoAnalysisInterface)) {
81
+			FlashMessages::addMessage(
82
+				I18N::translate('The parameters for the new view are not valid.'),
83
+				'danger'
84
+			);
85
+			return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
86
+		}
87 87
 
88
-        if ($type === 'map') {
89
-            $new_view = new GeoAnalysisMap(0, $tree, true, $description, $analysis, $place_depth);
90
-        } else {
91
-            $new_view = new GeoAnalysisTable(0, $tree, true, $description, $analysis, $place_depth);
92
-        }
88
+		if ($type === 'map') {
89
+			$new_view = new GeoAnalysisMap(0, $tree, true, $description, $analysis, $place_depth);
90
+		} else {
91
+			$new_view = new GeoAnalysisTable(0, $tree, true, $description, $analysis, $place_depth);
92
+		}
93 93
 
94
-        $new_view_id = $this->geoview_data_service->insertGetId($new_view);
95
-        if ($new_view_id > 0) {
96
-            FlashMessages::addMessage(
97
-                I18N::translate('The geographical dispersion analysis view has been successfully added.'),
98
-                'success'
99
-            );
100
-            //phpcs:ignore Generic.Files.LineLength.TooLong
101
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $new_view_id . '” has been added.');
102
-            return Registry::responseFactory()->redirect(
103
-                GeoAnalysisViewEditPage::class,
104
-                ['tree' => $tree->name(), 'view_id' => $new_view_id ]
105
-            );
106
-        } else {
107
-            FlashMessages::addMessage(
108
-                I18N::translate('An error occured while adding the geographical dispersion analysis view.'),
109
-                'danger'
110
-            );
111
-            //phpcs:ignore Generic.Files.LineLength.TooLong
112
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : A new View could not be added. See error log.');
113
-            return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
114
-        }
115
-    }
94
+		$new_view_id = $this->geoview_data_service->insertGetId($new_view);
95
+		if ($new_view_id > 0) {
96
+			FlashMessages::addMessage(
97
+				I18N::translate('The geographical dispersion analysis view has been successfully added.'),
98
+				'success'
99
+			);
100
+			//phpcs:ignore Generic.Files.LineLength.TooLong
101
+			Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $new_view_id . '” has been added.');
102
+			return Registry::responseFactory()->redirect(
103
+				GeoAnalysisViewEditPage::class,
104
+				['tree' => $tree->name(), 'view_id' => $new_view_id ]
105
+			);
106
+		} else {
107
+			FlashMessages::addMessage(
108
+				I18N::translate('An error occured while adding the geographical dispersion analysis view.'),
109
+				'danger'
110
+			);
111
+			//phpcs:ignore Generic.Files.LineLength.TooLong
112
+			Log::addConfigurationLog('Module ' . $this->module->title() . ' : A new View could not be added. See error log.');
113
+			return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
114
+		}
115
+	}
116 116
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -98,10 +98,10 @@  discard block
 block discarded – undo
98 98
                 'success'
99 99
             );
100 100
             //phpcs:ignore Generic.Files.LineLength.TooLong
101
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $new_view_id . '” has been added.');
101
+            Log::addConfigurationLog('Module '.$this->module->title().' : View “'.$new_view_id.'” has been added.');
102 102
             return Registry::responseFactory()->redirect(
103 103
                 GeoAnalysisViewEditPage::class,
104
-                ['tree' => $tree->name(), 'view_id' => $new_view_id ]
104
+                ['tree' => $tree->name(), 'view_id' => $new_view_id]
105 105
             );
106 106
         } else {
107 107
             FlashMessages::addMessage(
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
                 'danger'
110 110
             );
111 111
             //phpcs:ignore Generic.Files.LineLength.TooLong
112
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : A new View could not be added. See error log.');
112
+            Log::addConfigurationLog('Module '.$this->module->title().' : A new View could not be added. See error log.');
113 113
             return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
114 114
         }
115 115
     }
Please login to merge, or discard this patch.
app/Module/GeoDispersion/Http/RequestHandlers/GeoAnalysisViewEditAction.php 2 patches
Indentation   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -34,87 +34,87 @@
 block discarded – undo
34 34
  */
35 35
 class GeoAnalysisViewEditAction implements RequestHandlerInterface
36 36
 {
37
-    private ?GeoDispersionModule $module;
38
-    private GeoAnalysisViewDataService $geoview_data_service;
39
-
40
-    /**
41
-     * Constructor for GeoAnalysisViewEditAction Request Handler
42
-     *
43
-     * @param ModuleService $module_service
44
-     * @param GeoAnalysisViewDataService $geoview_data_service
45
-     */
46
-    public function __construct(ModuleService $module_service, GeoAnalysisViewDataService $geoview_data_service)
47
-    {
48
-        $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
49
-        $this->geoview_data_service = $geoview_data_service;
50
-    }
51
-
52
-    /**
53
-     * {@inheritDoc}
54
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
55
-     */
56
-    public function handle(ServerRequestInterface $request): ResponseInterface
57
-    {
58
-        $tree = Validator::attributes($request)->tree();
59
-
60
-        if ($this->module === null) {
61
-            FlashMessages::addMessage(
62
-                I18N::translate('The attached module could not be found.'),
63
-                'danger'
64
-            );
65
-            return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
66
-        }
67
-
68
-
69
-        $view_id = Validator::attributes($request)->integer('view_id', -1);
70
-        $view = $this->geoview_data_service->find($tree, $view_id, true);
71
-
72
-        $description    = Validator::parsedBody($request)->string('view_description', '');
73
-        $place_depth    = Validator::parsedBody($request)->integer('view_depth', 1);
74
-        $top_places     = Validator::parsedBody($request)->integer('view_top_places', 0);
75
-
76
-        $analysis = null;
77
-        try {
78
-            $analysis = app(Validator::parsedBody($request)->string('view_analysis', ''));
79
-        } catch (BindingResolutionException $ex) {
80
-        }
81
-
82
-        if (
83
-            $view === null
84
-            || $analysis === null || !($analysis instanceof GeoAnalysisInterface)
85
-            || $place_depth <= 0 && $top_places < 0
86
-        ) {
87
-            FlashMessages::addMessage(
88
-                I18N::translate('The parameters for view with ID “%s” are not valid.', I18N::number($view_id)),
89
-                'danger'
90
-            );
91
-            return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
92
-        }
93
-
94
-        $new_view = $view
95
-            ->with($view->isEnabled(), $description, $analysis, $place_depth, $top_places)
96
-            ->withGlobalSettingsUpdate($request);
97
-
98
-        try {
99
-            $this->geoview_data_service->update($new_view);
100
-            FlashMessages::addMessage(
101
-                I18N::translate('The geographical dispersion analysis view has been successfully updated.'),
102
-                'success'
103
-            );
104
-            //phpcs:ignore Generic.Files.LineLength.TooLong
105
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been updated.');
106
-        } catch (Throwable $ex) {
107
-            FlashMessages::addMessage(
108
-                I18N::translate('An error occured while updating the geographical dispersion analysis view.'),
109
-                'danger'
110
-            );
111
-            //phpcs:ignore Generic.Files.LineLength.TooLong
112
-            Log::addErrorLog('Module ' . $this->module->title() . ' : Error when updating view “' . $view->id() . '”: ' . $ex->getMessage());
113
-        }
114
-
115
-        return Registry::responseFactory()->redirect(GeoAnalysisViewEditPage::class, [
116
-            'tree' => $tree->name(),
117
-            'view_id' => $view->id()
118
-        ]);
119
-    }
37
+	private ?GeoDispersionModule $module;
38
+	private GeoAnalysisViewDataService $geoview_data_service;
39
+
40
+	/**
41
+	 * Constructor for GeoAnalysisViewEditAction Request Handler
42
+	 *
43
+	 * @param ModuleService $module_service
44
+	 * @param GeoAnalysisViewDataService $geoview_data_service
45
+	 */
46
+	public function __construct(ModuleService $module_service, GeoAnalysisViewDataService $geoview_data_service)
47
+	{
48
+		$this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
49
+		$this->geoview_data_service = $geoview_data_service;
50
+	}
51
+
52
+	/**
53
+	 * {@inheritDoc}
54
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
55
+	 */
56
+	public function handle(ServerRequestInterface $request): ResponseInterface
57
+	{
58
+		$tree = Validator::attributes($request)->tree();
59
+
60
+		if ($this->module === null) {
61
+			FlashMessages::addMessage(
62
+				I18N::translate('The attached module could not be found.'),
63
+				'danger'
64
+			);
65
+			return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
66
+		}
67
+
68
+
69
+		$view_id = Validator::attributes($request)->integer('view_id', -1);
70
+		$view = $this->geoview_data_service->find($tree, $view_id, true);
71
+
72
+		$description    = Validator::parsedBody($request)->string('view_description', '');
73
+		$place_depth    = Validator::parsedBody($request)->integer('view_depth', 1);
74
+		$top_places     = Validator::parsedBody($request)->integer('view_top_places', 0);
75
+
76
+		$analysis = null;
77
+		try {
78
+			$analysis = app(Validator::parsedBody($request)->string('view_analysis', ''));
79
+		} catch (BindingResolutionException $ex) {
80
+		}
81
+
82
+		if (
83
+			$view === null
84
+			|| $analysis === null || !($analysis instanceof GeoAnalysisInterface)
85
+			|| $place_depth <= 0 && $top_places < 0
86
+		) {
87
+			FlashMessages::addMessage(
88
+				I18N::translate('The parameters for view with ID “%s” are not valid.', I18N::number($view_id)),
89
+				'danger'
90
+			);
91
+			return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
92
+		}
93
+
94
+		$new_view = $view
95
+			->with($view->isEnabled(), $description, $analysis, $place_depth, $top_places)
96
+			->withGlobalSettingsUpdate($request);
97
+
98
+		try {
99
+			$this->geoview_data_service->update($new_view);
100
+			FlashMessages::addMessage(
101
+				I18N::translate('The geographical dispersion analysis view has been successfully updated.'),
102
+				'success'
103
+			);
104
+			//phpcs:ignore Generic.Files.LineLength.TooLong
105
+			Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been updated.');
106
+		} catch (Throwable $ex) {
107
+			FlashMessages::addMessage(
108
+				I18N::translate('An error occured while updating the geographical dispersion analysis view.'),
109
+				'danger'
110
+			);
111
+			//phpcs:ignore Generic.Files.LineLength.TooLong
112
+			Log::addErrorLog('Module ' . $this->module->title() . ' : Error when updating view “' . $view->id() . '”: ' . $ex->getMessage());
113
+		}
114
+
115
+		return Registry::responseFactory()->redirect(GeoAnalysisViewEditPage::class, [
116
+			'tree' => $tree->name(),
117
+			'view_id' => $view->id()
118
+		]);
119
+	}
120 120
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -102,14 +102,14 @@
 block discarded – undo
102 102
                 'success'
103 103
             );
104 104
             //phpcs:ignore Generic.Files.LineLength.TooLong
105
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been updated.');
105
+            Log::addConfigurationLog('Module '.$this->module->title().' : View “'.$view->id().'” has been updated.');
106 106
         } catch (Throwable $ex) {
107 107
             FlashMessages::addMessage(
108 108
                 I18N::translate('An error occured while updating the geographical dispersion analysis view.'),
109 109
                 'danger'
110 110
             );
111 111
             //phpcs:ignore Generic.Files.LineLength.TooLong
112
-            Log::addErrorLog('Module ' . $this->module->title() . ' : Error when updating view “' . $view->id() . '”: ' . $ex->getMessage());
112
+            Log::addErrorLog('Module '.$this->module->title().' : Error when updating view “'.$view->id().'”: '.$ex->getMessage());
113 113
         }
114 114
 
115 115
         return Registry::responseFactory()->redirect(GeoAnalysisViewEditPage::class, [
Please login to merge, or discard this patch.
Module/GeoDispersion/Http/RequestHandlers/MapAdapterDeleteInvalidAction.php 2 patches
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -35,77 +35,77 @@
 block discarded – undo
35 35
  */
36 36
 class MapAdapterDeleteInvalidAction implements RequestHandlerInterface
37 37
 {
38
-    private ?GeoDispersionModule $module;
39
-    private GeoAnalysisViewDataService $geoview_data_service;
40
-    private MapAdapterDataService $mapadapter_data_service;
38
+	private ?GeoDispersionModule $module;
39
+	private GeoAnalysisViewDataService $geoview_data_service;
40
+	private MapAdapterDataService $mapadapter_data_service;
41 41
 
42
-    /**
43
-     * Constructor for MapAdapterDeleteInvalidAction Request Handler
44
-     *
45
-     * @param ModuleService $module_service
46
-     * @param GeoAnalysisViewDataService $geoview_data_service
47
-     * @param MapAdapterDataService $mapadapter_data_service
48
-     */
49
-    public function __construct(
50
-        ModuleService $module_service,
51
-        GeoAnalysisViewDataService $geoview_data_service,
52
-        MapAdapterDataService $mapadapter_data_service
53
-    ) {
54
-        $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
55
-        $this->geoview_data_service = $geoview_data_service;
56
-        $this->mapadapter_data_service = $mapadapter_data_service;
57
-    }
42
+	/**
43
+	 * Constructor for MapAdapterDeleteInvalidAction Request Handler
44
+	 *
45
+	 * @param ModuleService $module_service
46
+	 * @param GeoAnalysisViewDataService $geoview_data_service
47
+	 * @param MapAdapterDataService $mapadapter_data_service
48
+	 */
49
+	public function __construct(
50
+		ModuleService $module_service,
51
+		GeoAnalysisViewDataService $geoview_data_service,
52
+		MapAdapterDataService $mapadapter_data_service
53
+	) {
54
+		$this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
55
+		$this->geoview_data_service = $geoview_data_service;
56
+		$this->mapadapter_data_service = $mapadapter_data_service;
57
+	}
58 58
 
59
-    /**
60
-     * {@inheritDoc}
61
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
62
-     */
63
-    public function handle(ServerRequestInterface $request): ResponseInterface
64
-    {
65
-        $tree = Validator::attributes($request)->tree();
59
+	/**
60
+	 * {@inheritDoc}
61
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
62
+	 */
63
+	public function handle(ServerRequestInterface $request): ResponseInterface
64
+	{
65
+		$tree = Validator::attributes($request)->tree();
66 66
 
67
-        if ($this->module === null) {
68
-            FlashMessages::addMessage(
69
-                I18N::translate('The attached module could not be found.'),
70
-                'danger'
71
-            );
72
-            return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
73
-        }
67
+		if ($this->module === null) {
68
+			FlashMessages::addMessage(
69
+				I18N::translate('The attached module could not be found.'),
70
+				'danger'
71
+			);
72
+			return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
73
+		}
74 74
 
75
-        $view_id = Validator::attributes($request)->integer('view_id', -1);
76
-        $view = $this->geoview_data_service->find($tree, $view_id);
75
+		$view_id = Validator::attributes($request)->integer('view_id', -1);
76
+		$view = $this->geoview_data_service->find($tree, $view_id);
77 77
 
78
-        if ($view === null || !($view instanceof GeoAnalysisMap)) {
79
-            FlashMessages::addMessage(
80
-                I18N::translate('The view with ID “%s” does not exist.', I18N::number($view_id)),
81
-                'danger'
82
-            );
83
-            return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
84
-        }
78
+		if ($view === null || !($view instanceof GeoAnalysisMap)) {
79
+			FlashMessages::addMessage(
80
+				I18N::translate('The view with ID “%s” does not exist.', I18N::number($view_id)),
81
+				'danger'
82
+			);
83
+			return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
84
+		}
85 85
 
86
-        /** @var \Illuminate\Support\Collection<int> $valid_map_adapters */
87
-        $valid_map_adapters = $this->mapadapter_data_service
88
-            ->allForView($view)
89
-            ->map(fn(GeoAnalysisMapAdapter $map_adapter): int => $map_adapter->id());
86
+		/** @var \Illuminate\Support\Collection<int> $valid_map_adapters */
87
+		$valid_map_adapters = $this->mapadapter_data_service
88
+			->allForView($view)
89
+			->map(fn(GeoAnalysisMapAdapter $map_adapter): int => $map_adapter->id());
90 90
 
91
-        try {
92
-            $this->mapadapter_data_service->deleteInvalid($view, $valid_map_adapters);
93
-            FlashMessages::addMessage(
94
-                I18N::translate('The invalid map configurations have been successfully deleted.'),
95
-                'success'
96
-            );
97
-        } catch (Throwable $ex) {
98
-            FlashMessages::addMessage(
99
-                I18N::translate('An error occured while deleting the invalid map configurations.'),
100
-                'danger'
101
-            );
102
-            //phpcs:ignore Generic.Files.LineLength.TooLong
103
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Error when deleting invalid map configurations: ' . $ex->getMessage());
104
-        }
91
+		try {
92
+			$this->mapadapter_data_service->deleteInvalid($view, $valid_map_adapters);
93
+			FlashMessages::addMessage(
94
+				I18N::translate('The invalid map configurations have been successfully deleted.'),
95
+				'success'
96
+			);
97
+		} catch (Throwable $ex) {
98
+			FlashMessages::addMessage(
99
+				I18N::translate('An error occured while deleting the invalid map configurations.'),
100
+				'danger'
101
+			);
102
+			//phpcs:ignore Generic.Files.LineLength.TooLong
103
+			Log::addConfigurationLog('Module ' . $this->module->title() . ' : Error when deleting invalid map configurations: ' . $ex->getMessage());
104
+		}
105 105
 
106
-        return Registry::responseFactory()->redirect(GeoAnalysisViewEditPage::class, [
107
-            'tree'      => $tree->name(),
108
-            'view_id'   => $view_id
109
-        ]);
110
-    }
106
+		return Registry::responseFactory()->redirect(GeoAnalysisViewEditPage::class, [
107
+			'tree'      => $tree->name(),
108
+			'view_id'   => $view_id
109
+		]);
110
+	}
111 111
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@
 block discarded – undo
100 100
                 'danger'
101 101
             );
102 102
             //phpcs:ignore Generic.Files.LineLength.TooLong
103
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : Error when deleting invalid map configurations: ' . $ex->getMessage());
103
+            Log::addConfigurationLog('Module '.$this->module->title().' : Error when deleting invalid map configurations: '.$ex->getMessage());
104 104
         }
105 105
 
106 106
         return Registry::responseFactory()->redirect(GeoAnalysisViewEditPage::class, [
Please login to merge, or discard this patch.
Module/GeoDispersion/Http/RequestHandlers/GeoAnalysisViewDeleteAction.php 2 patches
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -31,64 +31,64 @@
 block discarded – undo
31 31
  */
32 32
 class GeoAnalysisViewDeleteAction implements RequestHandlerInterface
33 33
 {
34
-    private ?GeoDispersionModule $module;
35
-    private GeoAnalysisViewDataService $geoview_data_service;
34
+	private ?GeoDispersionModule $module;
35
+	private GeoAnalysisViewDataService $geoview_data_service;
36 36
 
37
-    /**
38
-     * Constructor for GeoAnalysisViewDeleteAction Request Handler
39
-     *
40
-     * @param ModuleService $module_service
41
-     * @param GeoAnalysisViewDataService $geoview_data_service
42
-     */
43
-    public function __construct(ModuleService $module_service, GeoAnalysisViewDataService $geoview_data_service)
44
-    {
45
-        $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
46
-        $this->geoview_data_service = $geoview_data_service;
47
-    }
37
+	/**
38
+	 * Constructor for GeoAnalysisViewDeleteAction Request Handler
39
+	 *
40
+	 * @param ModuleService $module_service
41
+	 * @param GeoAnalysisViewDataService $geoview_data_service
42
+	 */
43
+	public function __construct(ModuleService $module_service, GeoAnalysisViewDataService $geoview_data_service)
44
+	{
45
+		$this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
46
+		$this->geoview_data_service = $geoview_data_service;
47
+	}
48 48
 
49
-    /**
50
-     * {@inheritDoc}
51
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
52
-     */
53
-    public function handle(ServerRequestInterface $request): ResponseInterface
54
-    {
55
-        $tree = Validator::attributes($request)->tree();
49
+	/**
50
+	 * {@inheritDoc}
51
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
52
+	 */
53
+	public function handle(ServerRequestInterface $request): ResponseInterface
54
+	{
55
+		$tree = Validator::attributes($request)->tree();
56 56
 
57
-        if ($this->module === null) {
58
-            FlashMessages::addMessage(
59
-                I18N::translate('The attached module could not be found.'),
60
-                'danger'
61
-            );
62
-            return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
63
-        }
57
+		if ($this->module === null) {
58
+			FlashMessages::addMessage(
59
+				I18N::translate('The attached module could not be found.'),
60
+				'danger'
61
+			);
62
+			return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
63
+		}
64 64
 
65
-        $view_id = Validator::attributes($request)->integer('view_id', -1);
66
-        $view = $this->geoview_data_service->find($tree, $view_id, true);
65
+		$view_id = Validator::attributes($request)->integer('view_id', -1);
66
+		$view = $this->geoview_data_service->find($tree, $view_id, true);
67 67
 
68
-        if ($view === null) {
69
-            FlashMessages::addMessage(
70
-                I18N::translate('The view with ID “%s” does not exist.', I18N::number($view_id)),
71
-                'danger'
72
-            );
73
-            return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
74
-        }
68
+		if ($view === null) {
69
+			FlashMessages::addMessage(
70
+				I18N::translate('The view with ID “%s” does not exist.', I18N::number($view_id)),
71
+				'danger'
72
+			);
73
+			return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
74
+		}
75 75
 
76
-        if ($this->geoview_data_service->delete($view) > 0) {
77
-            FlashMessages::addMessage(
78
-                I18N::translate('The geographical dispersion analysis view has been successfully deleted.'),
79
-                'success'
80
-            );
81
-            //phpcs:ignore Generic.Files.LineLength.TooLong
82
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been deleted.');
83
-        } else {
84
-            FlashMessages::addMessage(
85
-                I18N::translate('An error occured while deleting the geographical dispersion analysis view.'),
86
-                'danger'
87
-            );
88
-            //phpcs:ignore Generic.Files.LineLength.TooLong
89
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” could not be deleted. See error log.');
90
-        }
76
+		if ($this->geoview_data_service->delete($view) > 0) {
77
+			FlashMessages::addMessage(
78
+				I18N::translate('The geographical dispersion analysis view has been successfully deleted.'),
79
+				'success'
80
+			);
81
+			//phpcs:ignore Generic.Files.LineLength.TooLong
82
+			Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been deleted.');
83
+		} else {
84
+			FlashMessages::addMessage(
85
+				I18N::translate('An error occured while deleting the geographical dispersion analysis view.'),
86
+				'danger'
87
+			);
88
+			//phpcs:ignore Generic.Files.LineLength.TooLong
89
+			Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” could not be deleted. See error log.');
90
+		}
91 91
 
92
-        return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
93
-    }
92
+		return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
93
+	}
94 94
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,14 +79,14 @@
 block discarded – undo
79 79
                 'success'
80 80
             );
81 81
             //phpcs:ignore Generic.Files.LineLength.TooLong
82
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been deleted.');
82
+            Log::addConfigurationLog('Module '.$this->module->title().' : View “'.$view->id().'” has been deleted.');
83 83
         } else {
84 84
             FlashMessages::addMessage(
85 85
                 I18N::translate('An error occured while deleting the geographical dispersion analysis view.'),
86 86
                 'danger'
87 87
             );
88 88
             //phpcs:ignore Generic.Files.LineLength.TooLong
89
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” could not be deleted. See error log.');
89
+            Log::addConfigurationLog('Module '.$this->module->title().' : View “'.$view->id().'” could not be deleted. See error log.');
90 90
         }
91 91
 
92 92
         return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]);
Please login to merge, or discard this patch.
app/Module/GeoDispersion/Http/RequestHandlers/MapFeaturePropertyData.php 2 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -30,51 +30,51 @@
 block discarded – undo
30 30
  */
31 31
 class MapFeaturePropertyData implements RequestHandlerInterface
32 32
 {
33
-    private MapDefinitionsService $map_definition_service;
33
+	private MapDefinitionsService $map_definition_service;
34 34
 
35
-    /**
36
-     * Constructor for MapFeaturePropertyData Request Handler
37
-     *
38
-     * @param MapDefinitionsService $map_definition_service
39
-     */
40
-    public function __construct(
41
-        MapDefinitionsService $map_definition_service
42
-    ) {
43
-        $this->map_definition_service = $map_definition_service;
44
-    }
35
+	/**
36
+	 * Constructor for MapFeaturePropertyData Request Handler
37
+	 *
38
+	 * @param MapDefinitionsService $map_definition_service
39
+	 */
40
+	public function __construct(
41
+		MapDefinitionsService $map_definition_service
42
+	) {
43
+		$this->map_definition_service = $map_definition_service;
44
+	}
45 45
 
46
-    /**
47
-     * {@inheritDoc}
48
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
49
-     */
50
-    public function handle(ServerRequestInterface $request): ResponseInterface
51
-    {
52
-        $map_id = Validator::queryParams($request)->string(
53
-            'map_id',
54
-            Validator::attributes($request)->string('map_id', '')
55
-        );
46
+	/**
47
+	 * {@inheritDoc}
48
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
49
+	 */
50
+	public function handle(ServerRequestInterface $request): ResponseInterface
51
+	{
52
+		$map_id = Validator::queryParams($request)->string(
53
+			'map_id',
54
+			Validator::attributes($request)->string('map_id', '')
55
+		);
56 56
 
57
-        return Registry::responseFactory()->response(Registry::cache()->file()->remember(
58
-            'map-properties-' . $map_id,
59
-            function () use ($map_id): array {
60
-                $map = $this->map_definition_service->find($map_id);
61
-                if ($map === null) {
62
-                    throw new HttpNotFoundException(I18N::translate('The map could not be found.'));
63
-                }
57
+		return Registry::responseFactory()->response(Registry::cache()->file()->remember(
58
+			'map-properties-' . $map_id,
59
+			function () use ($map_id): array {
60
+				$map = $this->map_definition_service->find($map_id);
61
+				if ($map === null) {
62
+					throw new HttpNotFoundException(I18N::translate('The map could not be found.'));
63
+				}
64 64
 
65
-                $features = [];
66
-                collect($map->features())
67
-                    ->map(fn(Feature $feature): ?stdClass => $feature->getProperties())
68
-                    ->filter()
69
-                    ->map(fn(stdClass $properties): array => array_keys(get_object_vars($properties)))
70
-                    ->each(function (array $properties) use (&$features): void {
71
-                        $features = count($features) === 0 ? $properties : array_intersect($features, $properties);
72
-                    });
65
+				$features = [];
66
+				collect($map->features())
67
+					->map(fn(Feature $feature): ?stdClass => $feature->getProperties())
68
+					->filter()
69
+					->map(fn(stdClass $properties): array => array_keys(get_object_vars($properties)))
70
+					->each(function (array $properties) use (&$features): void {
71
+						$features = count($features) === 0 ? $properties : array_intersect($features, $properties);
72
+					});
73 73
 
74
-                usort($features, I18N::comparator());
75
-                return  $features;
76
-            },
77
-            86400000
78
-        ));
79
-    }
74
+				usort($features, I18N::comparator());
75
+				return  $features;
76
+			},
77
+			86400000
78
+		));
79
+	}
80 80
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
         );
56 56
 
57 57
         return Registry::responseFactory()->response(Registry::cache()->file()->remember(
58
-            'map-properties-' . $map_id,
59
-            function () use ($map_id): array {
58
+            'map-properties-'.$map_id,
59
+            function() use ($map_id): array {
60 60
                 $map = $this->map_definition_service->find($map_id);
61 61
                 if ($map === null) {
62 62
                     throw new HttpNotFoundException(I18N::translate('The map could not be found.'));
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
                 collect($map->features())
67 67
                     ->map(fn(Feature $feature): ?stdClass => $feature->getProperties())
68 68
                     ->filter()
69
-                    ->map(fn(stdClass $properties): array => array_keys(get_object_vars($properties)))
70
-                    ->each(function (array $properties) use (&$features): void {
69
+                    ->map(fn(stdClass $properties) : array => array_keys(get_object_vars($properties)))
70
+                    ->each(function(array $properties) use (&$features) : void {
71 71
                         $features = count($features) === 0 ? $properties : array_intersect($features, $properties);
72 72
                     });
73 73
 
Please login to merge, or discard this patch.
app/Module/GeoDispersion/Http/RequestHandlers/GeoAnalysisViewListData.php 2 patches
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -32,74 +32,74 @@
 block discarded – undo
32 32
  */
33 33
 class GeoAnalysisViewListData 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 GeoAnalysisViewListData Request Handler
40
-     *
41
-     * @param ModuleService $module_service
42
-     * @param GeoAnalysisViewDataService $geoview_data_service
43
-     */
44
-    public function __construct(
45
-        ModuleService $module_service,
46
-        GeoAnalysisViewDataService $geoview_data_service
47
-    ) {
48
-        $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
49
-        $this->geoview_data_service = $geoview_data_service;
50
-    }
38
+	/**
39
+	 * Constructor for GeoAnalysisViewListData Request Handler
40
+	 *
41
+	 * @param ModuleService $module_service
42
+	 * @param GeoAnalysisViewDataService $geoview_data_service
43
+	 */
44
+	public function __construct(
45
+		ModuleService $module_service,
46
+		GeoAnalysisViewDataService $geoview_data_service
47
+	) {
48
+		$this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
49
+		$this->geoview_data_service = $geoview_data_service;
50
+	}
51 51
 
52
-    /**
53
-     * {@inheritDoc}
54
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
55
-     */
56
-    public function handle(ServerRequestInterface $request): ResponseInterface
57
-    {
58
-        if ($this->module === null) {
59
-            throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
60
-        }
52
+	/**
53
+	 * {@inheritDoc}
54
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
55
+	 */
56
+	public function handle(ServerRequestInterface $request): ResponseInterface
57
+	{
58
+		if ($this->module === null) {
59
+			throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
60
+		}
61 61
 
62
-        $tree = Validator::attributes($request)->tree();
62
+		$tree = Validator::attributes($request)->tree();
63 63
 
64
-        $module = $this->module;
65
-        $module_name = $this->module->name();
66
-        return Registry::responseFactory()->response(['data' => $this->geoview_data_service->all($tree, true)
67
-            ->map(fn(AbstractGeoAnalysisView $view) => [
68
-                'edit' => view($module_name . '::admin/view-table-options', [
69
-                    'view_id' => $view->id(),
70
-                    'view_enabled' => $view->isEnabled(),
71
-                    'view_edit_route' => route(GeoAnalysisViewEditPage::class, [
72
-                        'tree' => $tree->name(),
73
-                        'view_id' => $view->id()
74
-                    ]),
75
-                    'view_delete_route' => route(GeoAnalysisViewDeleteAction::class, [
76
-                        'tree' => $tree->name(),
77
-                        'view_id' => $view->id()
78
-                    ]),
79
-                    'view_status_route' => route(GeoAnalysisViewStatusAction::class, [
80
-                        'tree' => $tree->name(),
81
-                        'view_id' => $view->id(),
82
-                        'enable' => $view->isEnabled() ? 0 : 1
83
-                    ]),
84
-                ]),
85
-                'enabled' =>  [
86
-                    'display' => view($module_name . '::components/yes-no-icons', ['yes' => $view->isEnabled()]),
87
-                    'raw' => $view->isEnabled() ? 0 : 1
88
-                ],
89
-                'type' =>  $view->icon($module),
90
-                'description' => [
91
-                    'display' => '<bdi>' . e($view->description()) . '</bdi>',
92
-                    'raw' => e($view->description())
93
-                ],
94
-                'analysis' => [
95
-                    'display' => '<bdi>' . e($view->analysis()->title()) . '</bdi>',
96
-                    'raw' => e($view->analysis()->title())
97
-                ],
98
-                'place_depth' => [
99
-                    'display' => I18N::number($view->placesDepth()),
100
-                    'raw' => $view->placesDepth()
101
-                ]
102
-            ])
103
-        ]);
104
-    }
64
+		$module = $this->module;
65
+		$module_name = $this->module->name();
66
+		return Registry::responseFactory()->response(['data' => $this->geoview_data_service->all($tree, true)
67
+			->map(fn(AbstractGeoAnalysisView $view) => [
68
+				'edit' => view($module_name . '::admin/view-table-options', [
69
+					'view_id' => $view->id(),
70
+					'view_enabled' => $view->isEnabled(),
71
+					'view_edit_route' => route(GeoAnalysisViewEditPage::class, [
72
+						'tree' => $tree->name(),
73
+						'view_id' => $view->id()
74
+					]),
75
+					'view_delete_route' => route(GeoAnalysisViewDeleteAction::class, [
76
+						'tree' => $tree->name(),
77
+						'view_id' => $view->id()
78
+					]),
79
+					'view_status_route' => route(GeoAnalysisViewStatusAction::class, [
80
+						'tree' => $tree->name(),
81
+						'view_id' => $view->id(),
82
+						'enable' => $view->isEnabled() ? 0 : 1
83
+					]),
84
+				]),
85
+				'enabled' =>  [
86
+					'display' => view($module_name . '::components/yes-no-icons', ['yes' => $view->isEnabled()]),
87
+					'raw' => $view->isEnabled() ? 0 : 1
88
+				],
89
+				'type' =>  $view->icon($module),
90
+				'description' => [
91
+					'display' => '<bdi>' . e($view->description()) . '</bdi>',
92
+					'raw' => e($view->description())
93
+				],
94
+				'analysis' => [
95
+					'display' => '<bdi>' . e($view->analysis()->title()) . '</bdi>',
96
+					'raw' => e($view->analysis()->title())
97
+				],
98
+				'place_depth' => [
99
+					'display' => I18N::number($view->placesDepth()),
100
+					'raw' => $view->placesDepth()
101
+				]
102
+			])
103
+		]);
104
+	}
105 105
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
         $module_name = $this->module->name();
66 66
         return Registry::responseFactory()->response(['data' => $this->geoview_data_service->all($tree, true)
67 67
             ->map(fn(AbstractGeoAnalysisView $view) => [
68
-                'edit' => view($module_name . '::admin/view-table-options', [
68
+                'edit' => view($module_name.'::admin/view-table-options', [
69 69
                     'view_id' => $view->id(),
70 70
                     'view_enabled' => $view->isEnabled(),
71 71
                     'view_edit_route' => route(GeoAnalysisViewEditPage::class, [
@@ -83,16 +83,16 @@  discard block
 block discarded – undo
83 83
                     ]),
84 84
                 ]),
85 85
                 'enabled' =>  [
86
-                    'display' => view($module_name . '::components/yes-no-icons', ['yes' => $view->isEnabled()]),
86
+                    'display' => view($module_name.'::components/yes-no-icons', ['yes' => $view->isEnabled()]),
87 87
                     'raw' => $view->isEnabled() ? 0 : 1
88 88
                 ],
89 89
                 'type' =>  $view->icon($module),
90 90
                 'description' => [
91
-                    'display' => '<bdi>' . e($view->description()) . '</bdi>',
91
+                    'display' => '<bdi>'.e($view->description()).'</bdi>',
92 92
                     'raw' => e($view->description())
93 93
                 ],
94 94
                 'analysis' => [
95
-                    'display' => '<bdi>' . e($view->analysis()->title()) . '</bdi>',
95
+                    'display' => '<bdi>'.e($view->analysis()->title()).'</bdi>',
96 96
                     'raw' => e($view->analysis()->title())
97 97
                 ],
98 98
                 'place_depth' => [
Please login to merge, or discard this patch.