Passed
Branch feature/2.1-geodispersion-dev (38d49e)
by Jonathan
04:17
created
src/Webtrees/Module/WelcomeBlock/WelcomeBlockModule.php 2 patches
Indentation   +155 added lines, -155 removed lines patch added patch discarded remove patch
@@ -33,159 +33,159 @@
 block discarded – undo
33 33
  */
34 34
 class WelcomeBlockModule extends AbstractModule implements ModuleMyArtJaubInterface, ModuleBlockInterface
35 35
 {
36
-    use ModuleMyArtJaubTrait;
37
-    use ModuleBlockTrait;
38
-
39
-    /**
40
-     * {@inheritDoc}
41
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::title()
42
-     */
43
-    public function title(): string
44
-    {
45
-        return /* I18N: Name of the “WelcomeBlock” module */ I18N::translate('MyArtJaub Welcome Block');
46
-    }
47
-
48
-    /**
49
-     * {@inheritDoc}
50
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::description()
51
-     */
52
-    public function description(): string
53
-    {
54
-        //phpcs:ignore Generic.Files.LineLength.TooLong
55
-        return /* I18N: Description of the “WelcomeBlock” module */ I18N::translate('The MyArtJaub Welcome block welcomes the visitor to the site, allows a quick login to the site, and displays statistics on visits.');
56
-    }
57
-
58
-    /**
59
-     * {@inheritDoc}
60
-     * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes()
61
-     */
62
-    public function loadRoutes(Map $router): void
63
-    {
64
-        $router->attach('', '', static function (Map $router): void {
65
-
66
-            $router->attach('', '/module-maj/welcomeblock/{block_id}', static function (Map $router): void {
67
-                $router->tokens(['block_id' => '\d+']);
68
-                $router->get(MatomoStats::class, '/matomostats', MatomoStats::class);
69
-            });
70
-        });
71
-    }
72
-
73
-    /**
74
-     * {@inheritDoc}
75
-     * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion()
76
-     */
77
-    public function customModuleVersion(): string
78
-    {
79
-        return '2.0.11-v.2';
80
-    }
81
-
82
-    /**
83
-     * {@inheritDoc}
84
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::getBlock()
85
-     */
86
-    public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string
87
-    {
88
-        $fab_welcome_block_view = app(\Fisharebest\Webtrees\Module\WelcomeBlockModule::class)
89
-            ->getBlock($tree, $block_id, ModuleBlockInterface::CONTEXT_EMBED);
90
-
91
-        $fab_login_block_view = app(\Fisharebest\Webtrees\Module\LoginBlockModule::class)
92
-            ->getBlock($tree, $block_id, ModuleBlockInterface::CONTEXT_EMBED);
93
-
94
-        $content = view($this->name() . '::block-embed', [
95
-            'block_id'                  =>  $block_id,
96
-            'fab_welcome_block_view'    =>  $fab_welcome_block_view,
97
-            'fab_login_block_view'      =>  $fab_login_block_view,
98
-            'matomo_enabled'            =>  $this->isMatomoEnabled($block_id),
99
-            'js_script_url'             =>  $this->assetUrl('js/welcomeblock.min.js')
100
-        ]);
101
-
102
-        if ($context !== self::CONTEXT_EMBED) {
103
-            return view('modules/block-template', [
104
-                'block'      => Str::kebab($this->name()),
105
-                'id'         => $block_id,
106
-                'config_url' => $this->configUrl($tree, $context, $block_id),
107
-                'title'      => $tree->title(),
108
-                'content'    => $content,
109
-            ]);
110
-        }
111
-
112
-        return $content;
113
-    }
114
-
115
-    /**
116
-     * {@inheritDoc}
117
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isTreeBlock()
118
-     */
119
-    public function isTreeBlock(): bool
120
-    {
121
-        return true;
122
-    }
123
-
124
-    /**
125
-     * {@inheritDoc}
126
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::editBlockConfiguration()
127
-     */
128
-    public function editBlockConfiguration(Tree $tree, int $block_id): string
129
-    {
130
-        return view($this->name() . '::config', $this->matomoSettings($block_id));
131
-    }
132
-
133
-    /**
134
-     * {@inheritDoc}
135
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::saveBlockConfiguration()
136
-     */
137
-    public function saveBlockConfiguration(ServerRequestInterface $request, int $block_id): void
138
-    {
139
-        $params = (array) $request->getParsedBody();
140
-
141
-        $matomo_enabled = $params['matomo_enabled'] == 'yes';
142
-        $this->setBlockSetting($block_id, 'matomo_enabled', $matomo_enabled ? 'yes' : 'no');
143
-        if (!$matomo_enabled) {
144
-            return;
145
-        }
146
-
147
-        if (filter_var($params['matomo_url'], FILTER_VALIDATE_URL) === false) {
148
-            FlashMessages::addMessage(I18N::translate('The Matomo URL provided is not valid.'), 'danger');
149
-            return;
150
-        }
151
-
152
-        if (filter_var($params['matomo_siteid'], FILTER_VALIDATE_INT) === false) {
153
-            FlashMessages::addMessage(I18N::translate('The Matomo Site ID provided is not valid.'), 'danger');
154
-            return;
155
-        }
156
-
157
-        $this
158
-            ->setBlockSetting($block_id, 'matomo_url', trim($params['matomo_url']))
159
-            ->setBlockSetting($block_id, 'matomo_token', trim($params['matomo_token']))
160
-            ->setBlockSetting($block_id, 'matomo_siteid', $params['matomo_siteid']);
161
-
162
-        Registry::cache()->file()->forget($this->name() . '-matomovisits-yearly-' . $block_id);
163
-    }
164
-
165
-    /**
166
-     * Returns whether Matomo statistics is enabled for a specific MyArtJaub WelcomeBlock block
167
-     *
168
-     * @param int $block_id
169
-     * @return bool
170
-     */
171
-    public function isMatomoEnabled(int $block_id): bool
172
-    {
173
-        return $this->getBlockSetting($block_id, 'matomo_enabled', 'no') === 'yes';
174
-    }
175
-
176
-    /**
177
-     * Returns settings for retrieving Matomo statistics for a specific MyArtJaub WelcomeBlock block
178
-     *
179
-     * @param int $block_id
180
-     * @return array<string, mixed>
181
-     */
182
-    public function matomoSettings(int $block_id): array
183
-    {
184
-        return [
185
-            'matomo_enabled' => $this->isMatomoEnabled($block_id),
186
-            'matomo_url' => $this->getBlockSetting($block_id, 'matomo_url'),
187
-            'matomo_token' => $this->getBlockSetting($block_id, 'matomo_token'),
188
-            'matomo_siteid'  => (int) $this->getBlockSetting($block_id, 'matomo_siteid', '0')
189
-        ];
190
-    }
36
+	use ModuleMyArtJaubTrait;
37
+	use ModuleBlockTrait;
38
+
39
+	/**
40
+	 * {@inheritDoc}
41
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::title()
42
+	 */
43
+	public function title(): string
44
+	{
45
+		return /* I18N: Name of the “WelcomeBlock” module */ I18N::translate('MyArtJaub Welcome Block');
46
+	}
47
+
48
+	/**
49
+	 * {@inheritDoc}
50
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::description()
51
+	 */
52
+	public function description(): string
53
+	{
54
+		//phpcs:ignore Generic.Files.LineLength.TooLong
55
+		return /* I18N: Description of the “WelcomeBlock” module */ I18N::translate('The MyArtJaub Welcome block welcomes the visitor to the site, allows a quick login to the site, and displays statistics on visits.');
56
+	}
57
+
58
+	/**
59
+	 * {@inheritDoc}
60
+	 * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes()
61
+	 */
62
+	public function loadRoutes(Map $router): void
63
+	{
64
+		$router->attach('', '', static function (Map $router): void {
65
+
66
+			$router->attach('', '/module-maj/welcomeblock/{block_id}', static function (Map $router): void {
67
+				$router->tokens(['block_id' => '\d+']);
68
+				$router->get(MatomoStats::class, '/matomostats', MatomoStats::class);
69
+			});
70
+		});
71
+	}
72
+
73
+	/**
74
+	 * {@inheritDoc}
75
+	 * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion()
76
+	 */
77
+	public function customModuleVersion(): string
78
+	{
79
+		return '2.0.11-v.2';
80
+	}
81
+
82
+	/**
83
+	 * {@inheritDoc}
84
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::getBlock()
85
+	 */
86
+	public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string
87
+	{
88
+		$fab_welcome_block_view = app(\Fisharebest\Webtrees\Module\WelcomeBlockModule::class)
89
+			->getBlock($tree, $block_id, ModuleBlockInterface::CONTEXT_EMBED);
90
+
91
+		$fab_login_block_view = app(\Fisharebest\Webtrees\Module\LoginBlockModule::class)
92
+			->getBlock($tree, $block_id, ModuleBlockInterface::CONTEXT_EMBED);
93
+
94
+		$content = view($this->name() . '::block-embed', [
95
+			'block_id'                  =>  $block_id,
96
+			'fab_welcome_block_view'    =>  $fab_welcome_block_view,
97
+			'fab_login_block_view'      =>  $fab_login_block_view,
98
+			'matomo_enabled'            =>  $this->isMatomoEnabled($block_id),
99
+			'js_script_url'             =>  $this->assetUrl('js/welcomeblock.min.js')
100
+		]);
101
+
102
+		if ($context !== self::CONTEXT_EMBED) {
103
+			return view('modules/block-template', [
104
+				'block'      => Str::kebab($this->name()),
105
+				'id'         => $block_id,
106
+				'config_url' => $this->configUrl($tree, $context, $block_id),
107
+				'title'      => $tree->title(),
108
+				'content'    => $content,
109
+			]);
110
+		}
111
+
112
+		return $content;
113
+	}
114
+
115
+	/**
116
+	 * {@inheritDoc}
117
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isTreeBlock()
118
+	 */
119
+	public function isTreeBlock(): bool
120
+	{
121
+		return true;
122
+	}
123
+
124
+	/**
125
+	 * {@inheritDoc}
126
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::editBlockConfiguration()
127
+	 */
128
+	public function editBlockConfiguration(Tree $tree, int $block_id): string
129
+	{
130
+		return view($this->name() . '::config', $this->matomoSettings($block_id));
131
+	}
132
+
133
+	/**
134
+	 * {@inheritDoc}
135
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::saveBlockConfiguration()
136
+	 */
137
+	public function saveBlockConfiguration(ServerRequestInterface $request, int $block_id): void
138
+	{
139
+		$params = (array) $request->getParsedBody();
140
+
141
+		$matomo_enabled = $params['matomo_enabled'] == 'yes';
142
+		$this->setBlockSetting($block_id, 'matomo_enabled', $matomo_enabled ? 'yes' : 'no');
143
+		if (!$matomo_enabled) {
144
+			return;
145
+		}
146
+
147
+		if (filter_var($params['matomo_url'], FILTER_VALIDATE_URL) === false) {
148
+			FlashMessages::addMessage(I18N::translate('The Matomo URL provided is not valid.'), 'danger');
149
+			return;
150
+		}
151
+
152
+		if (filter_var($params['matomo_siteid'], FILTER_VALIDATE_INT) === false) {
153
+			FlashMessages::addMessage(I18N::translate('The Matomo Site ID provided is not valid.'), 'danger');
154
+			return;
155
+		}
156
+
157
+		$this
158
+			->setBlockSetting($block_id, 'matomo_url', trim($params['matomo_url']))
159
+			->setBlockSetting($block_id, 'matomo_token', trim($params['matomo_token']))
160
+			->setBlockSetting($block_id, 'matomo_siteid', $params['matomo_siteid']);
161
+
162
+		Registry::cache()->file()->forget($this->name() . '-matomovisits-yearly-' . $block_id);
163
+	}
164
+
165
+	/**
166
+	 * Returns whether Matomo statistics is enabled for a specific MyArtJaub WelcomeBlock block
167
+	 *
168
+	 * @param int $block_id
169
+	 * @return bool
170
+	 */
171
+	public function isMatomoEnabled(int $block_id): bool
172
+	{
173
+		return $this->getBlockSetting($block_id, 'matomo_enabled', 'no') === 'yes';
174
+	}
175
+
176
+	/**
177
+	 * Returns settings for retrieving Matomo statistics for a specific MyArtJaub WelcomeBlock block
178
+	 *
179
+	 * @param int $block_id
180
+	 * @return array<string, mixed>
181
+	 */
182
+	public function matomoSettings(int $block_id): array
183
+	{
184
+		return [
185
+			'matomo_enabled' => $this->isMatomoEnabled($block_id),
186
+			'matomo_url' => $this->getBlockSetting($block_id, 'matomo_url'),
187
+			'matomo_token' => $this->getBlockSetting($block_id, 'matomo_token'),
188
+			'matomo_siteid'  => (int) $this->getBlockSetting($block_id, 'matomo_siteid', '0')
189
+		];
190
+	}
191 191
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
      */
62 62
     public function loadRoutes(Map $router): void
63 63
     {
64
-        $router->attach('', '', static function (Map $router): void {
64
+        $router->attach('', '', static function(Map $router): void {
65 65
 
66
-            $router->attach('', '/module-maj/welcomeblock/{block_id}', static function (Map $router): void {
66
+            $router->attach('', '/module-maj/welcomeblock/{block_id}', static function(Map $router): void {
67 67
                 $router->tokens(['block_id' => '\d+']);
68 68
                 $router->get(MatomoStats::class, '/matomostats', MatomoStats::class);
69 69
             });
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         $fab_login_block_view = app(\Fisharebest\Webtrees\Module\LoginBlockModule::class)
92 92
             ->getBlock($tree, $block_id, ModuleBlockInterface::CONTEXT_EMBED);
93 93
 
94
-        $content = view($this->name() . '::block-embed', [
94
+        $content = view($this->name().'::block-embed', [
95 95
             'block_id'                  =>  $block_id,
96 96
             'fab_welcome_block_view'    =>  $fab_welcome_block_view,
97 97
             'fab_login_block_view'      =>  $fab_login_block_view,
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
      */
128 128
     public function editBlockConfiguration(Tree $tree, int $block_id): string
129 129
     {
130
-        return view($this->name() . '::config', $this->matomoSettings($block_id));
130
+        return view($this->name().'::config', $this->matomoSettings($block_id));
131 131
     }
132 132
 
133 133
     /**
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      */
137 137
     public function saveBlockConfiguration(ServerRequestInterface $request, int $block_id): void
138 138
     {
139
-        $params = (array) $request->getParsedBody();
139
+        $params = (array)$request->getParsedBody();
140 140
 
141 141
         $matomo_enabled = $params['matomo_enabled'] == 'yes';
142 142
         $this->setBlockSetting($block_id, 'matomo_enabled', $matomo_enabled ? 'yes' : 'no');
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
             ->setBlockSetting($block_id, 'matomo_token', trim($params['matomo_token']))
160 160
             ->setBlockSetting($block_id, 'matomo_siteid', $params['matomo_siteid']);
161 161
 
162
-        Registry::cache()->file()->forget($this->name() . '-matomovisits-yearly-' . $block_id);
162
+        Registry::cache()->file()->forget($this->name().'-matomovisits-yearly-'.$block_id);
163 163
     }
164 164
 
165 165
     /**
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
             'matomo_enabled' => $this->isMatomoEnabled($block_id),
186 186
             'matomo_url' => $this->getBlockSetting($block_id, 'matomo_url'),
187 187
             'matomo_token' => $this->getBlockSetting($block_id, 'matomo_token'),
188
-            'matomo_siteid'  => (int) $this->getBlockSetting($block_id, 'matomo_siteid', '0')
188
+            'matomo_siteid'  => (int)$this->getBlockSetting($block_id, 'matomo_siteid', '0')
189 189
         ];
190 190
     }
191 191
 }
Please login to merge, or discard this patch.
src/Webtrees/Module/Sosa/SosaModule.php 2 patches
Indentation   +250 added lines, -250 removed lines patch added patch discarded remove patch
@@ -54,256 +54,256 @@
 block discarded – undo
54 54
  * Identify and produce statistics about Sosa ancestors
55 55
  */
56 56
 class SosaModule extends AbstractModule implements
57
-    ModuleMyArtJaubInterface,
58
-    ModuleGlobalInterface,
59
-    ModuleMenuInterface,
60
-    ModuleSidebarInterface,
61
-    ModuleGeoAnalysisProviderInterface
57
+	ModuleMyArtJaubInterface,
58
+	ModuleGlobalInterface,
59
+	ModuleMenuInterface,
60
+	ModuleSidebarInterface,
61
+	ModuleGeoAnalysisProviderInterface
62 62
 {
63
-    use ModuleMyArtJaubTrait {
64
-        boot as traitBoot;
65
-    }
66
-    use ModuleGlobalTrait;
67
-    use ModuleMenuTrait;
68
-    use ModuleSidebarTrait;
69
-
70
-    // How to update the database schema for this module
71
-    private const SCHEMA_TARGET_VERSION   = 3;
72
-    private const SCHEMA_SETTING_NAME     = 'MAJ_SOSA_SCHEMA_VERSION';
73
-    private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema';
63
+	use ModuleMyArtJaubTrait {
64
+		boot as traitBoot;
65
+	}
66
+	use ModuleGlobalTrait;
67
+	use ModuleMenuTrait;
68
+	use ModuleSidebarTrait;
69
+
70
+	// How to update the database schema for this module
71
+	private const SCHEMA_TARGET_VERSION   = 3;
72
+	private const SCHEMA_SETTING_NAME     = 'MAJ_SOSA_SCHEMA_VERSION';
73
+	private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema';
74 74
 /**
75
-     * {@inheritDoc}
76
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::title()
77
-     */
78
-    public function title(): string
79
-    {
80
-        return /* I18N: Name of the “Sosa” module */ I18N::translate('Sosa');
81
-    }
82
-
83
-    /**
84
-     * {@inheritDoc}
85
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::description()
86
-     */
87
-    public function description(): string
88
-    {
89
-        //phpcs:ignore Generic.Files.LineLength.TooLong
90
-        return /* I18N: Description of the “Sosa” module */ I18N::translate('Calculate and display Sosa ancestors of the root person.');
91
-    }
92
-
93
-    /**
94
-     * {@inheritDoc}
95
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::boot()
96
-     */
97
-    public function boot(): void
98
-    {
99
-        $this->traitBoot();
100
-        app(MigrationService::class)->updateSchema(
101
-            self::SCHEMA_MIGRATION_PREFIX,
102
-            self::SCHEMA_SETTING_NAME,
103
-            self::SCHEMA_TARGET_VERSION
104
-        );
105
-    }
106
-
107
-    /**
108
-     * {@inheritDoc}
109
-     * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes()
110
-     */
111
-    public function loadRoutes(Map $router): void
112
-    {
113
-        $router->attach('', '', static function (Map $router): void {
114
-
115
-            $router->attach('', '/module-maj/sosa', static function (Map $router): void {
116
-
117
-                $router->attach('', '/list', static function (Map $router): void {
118
-                    $router->tokens(['gen' => '\d+']);
119
-                    $router->get(AncestorsList::class, '/ancestors/{tree}{/gen}', AncestorsList::class);
120
-                    $router->get(AncestorsListIndividual::class, '/ancestors/{tree}/{gen}/tab/individuals', AncestorsListIndividual::class);    //phpcs:ignore Generic.Files.LineLength.TooLong
121
-                    $router->get(AncestorsListFamily::class, '/ancestors/{tree}/{gen}/tab/families', AncestorsListFamily::class);   //phpcs:ignore Generic.Files.LineLength.TooLong
122
-                    $router->get(MissingAncestorsList::class, '/missing/{tree}{/gen}', MissingAncestorsList::class);
123
-                });
124
-
125
-                $router->attach('', '/statistics/{tree}', static function (Map $router): void {
126
-
127
-                    $router->get(SosaStatistics::class, '', SosaStatistics::class);
128
-                    $router->get(PedigreeCollapseData::class, '/pedigreecollapse', PedigreeCollapseData::class);
129
-                });
130
-
131
-                $router->attach('', '/config/{tree}', static function (Map $router): void {
132
-
133
-                    $router->get(SosaConfig::class, '', SosaConfig::class);
134
-                    $router->post(SosaConfigAction::class, '', SosaConfigAction::class);
135
-                    $router->get(SosaComputeModal::class, '/compute/{xref}', SosaComputeModal::class);
136
-                    $router->post(SosaComputeAction::class, '/compute', SosaComputeAction::class);
137
-                });
138
-            });
139
-        });
140
-    }
141
-
142
-    /**
143
-     * {@inheritDoc}
144
-     * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion()
145
-     */
146
-    public function customModuleVersion(): string
147
-    {
148
-        return '2.1.0-v.1';
149
-    }
150
-
151
-    /**
152
-     * {@inheritDoc}
153
-     * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::defaultMenuOrder()
154
-     */
155
-    public function defaultMenuOrder(): int
156
-    {
157
-        return 7;
158
-    }
159
-
160
-    /**
161
-     * {@inhericDoc}
162
-     * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::getMenu()
163
-     */
164
-    public function getMenu(Tree $tree): ?Menu
165
-    {
166
-        $menu = new Menu(I18N::translate('Sosa Statistics'));
167
-        $menu->setClass('menu-maj-sosa');
168
-        $menu->setSubmenus([
169
-            new Menu(
170
-                I18N::translate('Sosa Ancestors'),
171
-                route(AncestorsList::class, ['tree' => $tree->name()]),
172
-                'menu-maj-sosa-list',
173
-                ['rel' => 'nofollow']
174
-            ),
175
-            new Menu(
176
-                I18N::translate('Missing Ancestors'),
177
-                route(MissingAncestorsList::class, ['tree' => $tree->name()]),
178
-                'menu-maj-sosa-missing',
179
-                ['rel' => 'nofollow']
180
-            ),
181
-            new Menu(
182
-                I18N::translate('Sosa Statistics'),
183
-                route(SosaStatistics::class, ['tree' => $tree->name()]),
184
-                'menu-maj-sosa-stats'
185
-            )
186
-        ]);
187
-
188
-        if (Auth::check()) {
189
-            $menu->addSubmenu(new Menu(
190
-                I18N::translate('Sosa Configuration'),
191
-                route(SosaConfig::class, ['tree' => $tree->name()]),
192
-                'menu-maj-sosa-config'
193
-            ));
194
-
195
-            /** @var ServerRequestInterface $request */
196
-            $request = app(ServerRequestInterface::class);
197
-            $route = $request->getAttribute('route');
198
-            assert($route instanceof Route);
199
-
200
-            $root_indi_id = $tree->getUserPreference(Auth::user(), 'MAJ_SOSA_ROOT_ID');
201
-
202
-            if ($route->name === IndividualPage::class && mb_strlen($root_indi_id) > 0) {
203
-                $xref = $request->getAttribute('xref');
204
-                assert(is_string($xref));
205
-
206
-                $menu->addSubmenu(new Menu(
207
-                    I18N::translate('Complete Sosas'),
208
-                    '#',
209
-                    'menu-maj-sosa-compute',
210
-                    [
211
-                        'rel'           => 'nofollow',
212
-                        'data-href'     => route(SosaComputeModal::class, ['tree' => $tree->name(), 'xref' => $xref]),
213
-                        'data-target'   => '#wt-ajax-modal',
214
-                        'data-toggle'   => 'modal',
215
-                        'data-backdrop' => 'static'
216
-                    ]
217
-                ));
218
-            }
219
-        }
220
-
221
-        return $menu;
222
-    }
223
-
224
-    /**
225
-     * {@inheritDoc}
226
-     * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::headContent()
227
-     */
228
-    public function headContent(): string
229
-    {
230
-        return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">';
231
-    }
232
-
233
-    /**
234
-     * {@inheritDoc}
235
-     * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::bodyContent()
236
-     */
237
-    public function bodyContent(): string
238
-    {
239
-        return '<script src="' . $this->assetUrl('js/sosa.min.js') . '"></script>';
240
-    }
241
-
242
-    /**
243
-     * {@inheritDoc}
244
-     * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::sidebarTitle()
245
-     */
246
-    public function sidebarTitle(): string
247
-    {
248
-        $request = app(ServerRequestInterface::class);
249
-        $xref = $request->getAttribute('xref');
250
-        $tree = $request->getAttribute('tree');
251
-        $user = Auth::check() ? Auth::user() : new DefaultUser();
252
-
253
-        $individual = Registry::individualFactory()->make($xref, $tree);
254
-
255
-        return view($this->name() . '::sidebar/title', [
256
-            'module_name'   =>  $this->name(),
257
-            'sosa_numbers'  =>  app(SosaRecordsService::class)->sosaNumbers($tree, $user, $individual)
258
-        ]);
259
-    }
260
-
261
-    /**
262
-     * {@inheritDoc}
263
-     * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::getSidebarContent()
264
-     */
265
-    public function getSidebarContent(Individual $individual): string
266
-    {
267
-        $sosa_root_xref = $individual->tree()->getUserPreference(Auth::user(), 'MAJ_SOSA_ROOT_ID');
268
-        $sosa_root = Registry::individualFactory()->make($sosa_root_xref, $individual->tree());
269
-        $user = Auth::check() ? Auth::user() : new DefaultUser();
270
-
271
-        return view($this->name() . '::sidebar/content', [
272
-            'sosa_ancestor' =>  $individual,
273
-            'sosa_root'     =>  $sosa_root,
274
-            'sosa_numbers'  =>  app(SosaRecordsService::class)->sosaNumbers($individual->tree(), $user, $individual)
275
-        ]);
276
-    }
277
-
278
-    /**
279
-     * {@inheritDoc}
280
-     * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::hasSidebarContent()
281
-     */
282
-    public function hasSidebarContent(Individual $individual): bool
283
-    {
284
-        $user = Auth::check() ? Auth::user() : new DefaultUser();
285
-
286
-        return app(SosaRecordsService::class)
287
-            ->sosaNumbers($individual->tree(), $user, $individual)->count() > 0;
288
-    }
289
-
290
-    /**
291
-     * {@inheritDoc}
292
-     * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::defaultSidebarOrder()
293
-     */
294
-    public function defaultSidebarOrder(): int
295
-    {
296
-        return 1;
297
-    }
298
-
299
-    /**
300
-     * {@inheritDoc}
301
-     * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\ModuleGeoAnalysisProviderInterface::listGeoAnalyses()
302
-     */
303
-    public function listGeoAnalyses(): array
304
-    {
305
-        return [
306
-            SosaByGenerationGeoAnalysis::class
307
-        ];
308
-    }
75
+	 * {@inheritDoc}
76
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::title()
77
+	 */
78
+	public function title(): string
79
+	{
80
+		return /* I18N: Name of the “Sosa” module */ I18N::translate('Sosa');
81
+	}
82
+
83
+	/**
84
+	 * {@inheritDoc}
85
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::description()
86
+	 */
87
+	public function description(): string
88
+	{
89
+		//phpcs:ignore Generic.Files.LineLength.TooLong
90
+		return /* I18N: Description of the “Sosa” module */ I18N::translate('Calculate and display Sosa ancestors of the root person.');
91
+	}
92
+
93
+	/**
94
+	 * {@inheritDoc}
95
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::boot()
96
+	 */
97
+	public function boot(): void
98
+	{
99
+		$this->traitBoot();
100
+		app(MigrationService::class)->updateSchema(
101
+			self::SCHEMA_MIGRATION_PREFIX,
102
+			self::SCHEMA_SETTING_NAME,
103
+			self::SCHEMA_TARGET_VERSION
104
+		);
105
+	}
106
+
107
+	/**
108
+	 * {@inheritDoc}
109
+	 * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes()
110
+	 */
111
+	public function loadRoutes(Map $router): void
112
+	{
113
+		$router->attach('', '', static function (Map $router): void {
114
+
115
+			$router->attach('', '/module-maj/sosa', static function (Map $router): void {
116
+
117
+				$router->attach('', '/list', static function (Map $router): void {
118
+					$router->tokens(['gen' => '\d+']);
119
+					$router->get(AncestorsList::class, '/ancestors/{tree}{/gen}', AncestorsList::class);
120
+					$router->get(AncestorsListIndividual::class, '/ancestors/{tree}/{gen}/tab/individuals', AncestorsListIndividual::class);    //phpcs:ignore Generic.Files.LineLength.TooLong
121
+					$router->get(AncestorsListFamily::class, '/ancestors/{tree}/{gen}/tab/families', AncestorsListFamily::class);   //phpcs:ignore Generic.Files.LineLength.TooLong
122
+					$router->get(MissingAncestorsList::class, '/missing/{tree}{/gen}', MissingAncestorsList::class);
123
+				});
124
+
125
+				$router->attach('', '/statistics/{tree}', static function (Map $router): void {
126
+
127
+					$router->get(SosaStatistics::class, '', SosaStatistics::class);
128
+					$router->get(PedigreeCollapseData::class, '/pedigreecollapse', PedigreeCollapseData::class);
129
+				});
130
+
131
+				$router->attach('', '/config/{tree}', static function (Map $router): void {
132
+
133
+					$router->get(SosaConfig::class, '', SosaConfig::class);
134
+					$router->post(SosaConfigAction::class, '', SosaConfigAction::class);
135
+					$router->get(SosaComputeModal::class, '/compute/{xref}', SosaComputeModal::class);
136
+					$router->post(SosaComputeAction::class, '/compute', SosaComputeAction::class);
137
+				});
138
+			});
139
+		});
140
+	}
141
+
142
+	/**
143
+	 * {@inheritDoc}
144
+	 * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion()
145
+	 */
146
+	public function customModuleVersion(): string
147
+	{
148
+		return '2.1.0-v.1';
149
+	}
150
+
151
+	/**
152
+	 * {@inheritDoc}
153
+	 * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::defaultMenuOrder()
154
+	 */
155
+	public function defaultMenuOrder(): int
156
+	{
157
+		return 7;
158
+	}
159
+
160
+	/**
161
+	 * {@inhericDoc}
162
+	 * @see \Fisharebest\Webtrees\Module\ModuleMenuInterface::getMenu()
163
+	 */
164
+	public function getMenu(Tree $tree): ?Menu
165
+	{
166
+		$menu = new Menu(I18N::translate('Sosa Statistics'));
167
+		$menu->setClass('menu-maj-sosa');
168
+		$menu->setSubmenus([
169
+			new Menu(
170
+				I18N::translate('Sosa Ancestors'),
171
+				route(AncestorsList::class, ['tree' => $tree->name()]),
172
+				'menu-maj-sosa-list',
173
+				['rel' => 'nofollow']
174
+			),
175
+			new Menu(
176
+				I18N::translate('Missing Ancestors'),
177
+				route(MissingAncestorsList::class, ['tree' => $tree->name()]),
178
+				'menu-maj-sosa-missing',
179
+				['rel' => 'nofollow']
180
+			),
181
+			new Menu(
182
+				I18N::translate('Sosa Statistics'),
183
+				route(SosaStatistics::class, ['tree' => $tree->name()]),
184
+				'menu-maj-sosa-stats'
185
+			)
186
+		]);
187
+
188
+		if (Auth::check()) {
189
+			$menu->addSubmenu(new Menu(
190
+				I18N::translate('Sosa Configuration'),
191
+				route(SosaConfig::class, ['tree' => $tree->name()]),
192
+				'menu-maj-sosa-config'
193
+			));
194
+
195
+			/** @var ServerRequestInterface $request */
196
+			$request = app(ServerRequestInterface::class);
197
+			$route = $request->getAttribute('route');
198
+			assert($route instanceof Route);
199
+
200
+			$root_indi_id = $tree->getUserPreference(Auth::user(), 'MAJ_SOSA_ROOT_ID');
201
+
202
+			if ($route->name === IndividualPage::class && mb_strlen($root_indi_id) > 0) {
203
+				$xref = $request->getAttribute('xref');
204
+				assert(is_string($xref));
205
+
206
+				$menu->addSubmenu(new Menu(
207
+					I18N::translate('Complete Sosas'),
208
+					'#',
209
+					'menu-maj-sosa-compute',
210
+					[
211
+						'rel'           => 'nofollow',
212
+						'data-href'     => route(SosaComputeModal::class, ['tree' => $tree->name(), 'xref' => $xref]),
213
+						'data-target'   => '#wt-ajax-modal',
214
+						'data-toggle'   => 'modal',
215
+						'data-backdrop' => 'static'
216
+					]
217
+				));
218
+			}
219
+		}
220
+
221
+		return $menu;
222
+	}
223
+
224
+	/**
225
+	 * {@inheritDoc}
226
+	 * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::headContent()
227
+	 */
228
+	public function headContent(): string
229
+	{
230
+		return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">';
231
+	}
232
+
233
+	/**
234
+	 * {@inheritDoc}
235
+	 * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::bodyContent()
236
+	 */
237
+	public function bodyContent(): string
238
+	{
239
+		return '<script src="' . $this->assetUrl('js/sosa.min.js') . '"></script>';
240
+	}
241
+
242
+	/**
243
+	 * {@inheritDoc}
244
+	 * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::sidebarTitle()
245
+	 */
246
+	public function sidebarTitle(): string
247
+	{
248
+		$request = app(ServerRequestInterface::class);
249
+		$xref = $request->getAttribute('xref');
250
+		$tree = $request->getAttribute('tree');
251
+		$user = Auth::check() ? Auth::user() : new DefaultUser();
252
+
253
+		$individual = Registry::individualFactory()->make($xref, $tree);
254
+
255
+		return view($this->name() . '::sidebar/title', [
256
+			'module_name'   =>  $this->name(),
257
+			'sosa_numbers'  =>  app(SosaRecordsService::class)->sosaNumbers($tree, $user, $individual)
258
+		]);
259
+	}
260
+
261
+	/**
262
+	 * {@inheritDoc}
263
+	 * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::getSidebarContent()
264
+	 */
265
+	public function getSidebarContent(Individual $individual): string
266
+	{
267
+		$sosa_root_xref = $individual->tree()->getUserPreference(Auth::user(), 'MAJ_SOSA_ROOT_ID');
268
+		$sosa_root = Registry::individualFactory()->make($sosa_root_xref, $individual->tree());
269
+		$user = Auth::check() ? Auth::user() : new DefaultUser();
270
+
271
+		return view($this->name() . '::sidebar/content', [
272
+			'sosa_ancestor' =>  $individual,
273
+			'sosa_root'     =>  $sosa_root,
274
+			'sosa_numbers'  =>  app(SosaRecordsService::class)->sosaNumbers($individual->tree(), $user, $individual)
275
+		]);
276
+	}
277
+
278
+	/**
279
+	 * {@inheritDoc}
280
+	 * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::hasSidebarContent()
281
+	 */
282
+	public function hasSidebarContent(Individual $individual): bool
283
+	{
284
+		$user = Auth::check() ? Auth::user() : new DefaultUser();
285
+
286
+		return app(SosaRecordsService::class)
287
+			->sosaNumbers($individual->tree(), $user, $individual)->count() > 0;
288
+	}
289
+
290
+	/**
291
+	 * {@inheritDoc}
292
+	 * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::defaultSidebarOrder()
293
+	 */
294
+	public function defaultSidebarOrder(): int
295
+	{
296
+		return 1;
297
+	}
298
+
299
+	/**
300
+	 * {@inheritDoc}
301
+	 * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\ModuleGeoAnalysisProviderInterface::listGeoAnalyses()
302
+	 */
303
+	public function listGeoAnalyses(): array
304
+	{
305
+		return [
306
+			SosaByGenerationGeoAnalysis::class
307
+		];
308
+	}
309 309
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     // How to update the database schema for this module
71 71
     private const SCHEMA_TARGET_VERSION   = 3;
72 72
     private const SCHEMA_SETTING_NAME     = 'MAJ_SOSA_SCHEMA_VERSION';
73
-    private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema';
73
+    private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__.'\Schema';
74 74
 /**
75 75
      * {@inheritDoc}
76 76
      * @see \Fisharebest\Webtrees\Module\AbstractModule::title()
@@ -110,25 +110,25 @@  discard block
 block discarded – undo
110 110
      */
111 111
     public function loadRoutes(Map $router): void
112 112
     {
113
-        $router->attach('', '', static function (Map $router): void {
113
+        $router->attach('', '', static function(Map $router): void {
114 114
 
115
-            $router->attach('', '/module-maj/sosa', static function (Map $router): void {
115
+            $router->attach('', '/module-maj/sosa', static function(Map $router): void {
116 116
 
117
-                $router->attach('', '/list', static function (Map $router): void {
117
+                $router->attach('', '/list', static function(Map $router): void {
118 118
                     $router->tokens(['gen' => '\d+']);
119 119
                     $router->get(AncestorsList::class, '/ancestors/{tree}{/gen}', AncestorsList::class);
120
-                    $router->get(AncestorsListIndividual::class, '/ancestors/{tree}/{gen}/tab/individuals', AncestorsListIndividual::class);    //phpcs:ignore Generic.Files.LineLength.TooLong
121
-                    $router->get(AncestorsListFamily::class, '/ancestors/{tree}/{gen}/tab/families', AncestorsListFamily::class);   //phpcs:ignore Generic.Files.LineLength.TooLong
120
+                    $router->get(AncestorsListIndividual::class, '/ancestors/{tree}/{gen}/tab/individuals', AncestorsListIndividual::class); //phpcs:ignore Generic.Files.LineLength.TooLong
121
+                    $router->get(AncestorsListFamily::class, '/ancestors/{tree}/{gen}/tab/families', AncestorsListFamily::class); //phpcs:ignore Generic.Files.LineLength.TooLong
122 122
                     $router->get(MissingAncestorsList::class, '/missing/{tree}{/gen}', MissingAncestorsList::class);
123 123
                 });
124 124
 
125
-                $router->attach('', '/statistics/{tree}', static function (Map $router): void {
125
+                $router->attach('', '/statistics/{tree}', static function(Map $router): void {
126 126
 
127 127
                     $router->get(SosaStatistics::class, '', SosaStatistics::class);
128 128
                     $router->get(PedigreeCollapseData::class, '/pedigreecollapse', PedigreeCollapseData::class);
129 129
                 });
130 130
 
131
-                $router->attach('', '/config/{tree}', static function (Map $router): void {
131
+                $router->attach('', '/config/{tree}', static function(Map $router): void {
132 132
 
133 133
                     $router->get(SosaConfig::class, '', SosaConfig::class);
134 134
                     $router->post(SosaConfigAction::class, '', SosaConfigAction::class);
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
      */
228 228
     public function headContent(): string
229 229
     {
230
-        return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">';
230
+        return '<link rel="stylesheet" href="'.e($this->moduleCssUrl()).'">';
231 231
     }
232 232
 
233 233
     /**
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
      */
237 237
     public function bodyContent(): string
238 238
     {
239
-        return '<script src="' . $this->assetUrl('js/sosa.min.js') . '"></script>';
239
+        return '<script src="'.$this->assetUrl('js/sosa.min.js').'"></script>';
240 240
     }
241 241
 
242 242
     /**
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 
253 253
         $individual = Registry::individualFactory()->make($xref, $tree);
254 254
 
255
-        return view($this->name() . '::sidebar/title', [
255
+        return view($this->name().'::sidebar/title', [
256 256
             'module_name'   =>  $this->name(),
257 257
             'sosa_numbers'  =>  app(SosaRecordsService::class)->sosaNumbers($tree, $user, $individual)
258 258
         ]);
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
         $sosa_root = Registry::individualFactory()->make($sosa_root_xref, $individual->tree());
269 269
         $user = Auth::check() ? Auth::user() : new DefaultUser();
270 270
 
271
-        return view($this->name() . '::sidebar/content', [
271
+        return view($this->name().'::sidebar/content', [
272 272
             'sosa_ancestor' =>  $individual,
273 273
             'sosa_root'     =>  $sosa_root,
274 274
             'sosa_numbers'  =>  app(SosaRecordsService::class)->sosaNumbers($individual->tree(), $user, $individual)
Please login to merge, or discard this patch.
src/Webtrees/Module/GeoDispersion/GeoDispersionModule.php 2 patches
Indentation   +180 added lines, -180 removed lines patch added patch discarded remove patch
@@ -58,185 +58,185 @@
 block discarded – undo
58 58
  * Geographical Dispersion Module.
59 59
  */
60 60
 class GeoDispersionModule extends AbstractModule implements
61
-    ModuleMyArtJaubInterface,
62
-    ModuleChartInterface,
63
-    ModuleConfigInterface,
64
-    ModuleGlobalInterface,
65
-    ModuleGeoAnalysisProviderInterface,
66
-    ModulePlaceMapperProviderInterface
61
+	ModuleMyArtJaubInterface,
62
+	ModuleChartInterface,
63
+	ModuleConfigInterface,
64
+	ModuleGlobalInterface,
65
+	ModuleGeoAnalysisProviderInterface,
66
+	ModulePlaceMapperProviderInterface
67 67
 {
68
-    use ModuleMyArtJaubTrait {
69
-        boot as traitBoot;
70
-    }
71
-    use ModuleChartTrait;
72
-    use ModuleConfigTrait;
73
-    use ModuleGlobalTrait;
74
-
75
-    // How to update the database schema for this module
76
-    private const SCHEMA_TARGET_VERSION   = 2;
77
-    private const SCHEMA_SETTING_NAME     = 'MAJ_GEODISP_SCHEMA_VERSION';
78
-    private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema';
79
-
80
-    /**
81
-     * {@inheritDoc}
82
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::title()
83
-     */
84
-    public function title(): string
85
-    {
86
-        return /* I18N: Name of the “GeoDispersion” module */ I18N::translate('Geographical Dispersion');
87
-    }
88
-
89
-    /**
90
-     * {@inheritDoc}
91
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::description()
92
-     */
93
-    public function description(): string
94
-    {
95
-        //phpcs:ignore Generic.Files.LineLength.TooLong
96
-        return /* I18N: Description of the “GeoDispersion” module */ I18N::translate('Perform and display geographical dispersion analysis');
97
-    }
98
-
99
-    /**
100
-     * {@inheritDoc}
101
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::boot()
102
-     */
103
-    public function boot(): void
104
-    {
105
-        $this->traitBoot();
106
-        app(MigrationService::class)->updateSchema(
107
-            self::SCHEMA_MIGRATION_PREFIX,
108
-            self::SCHEMA_SETTING_NAME,
109
-            self::SCHEMA_TARGET_VERSION
110
-        );
111
-    }
112
-
113
-    /**
114
-     * {@inheritDoc}
115
-     * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion()
116
-     */
117
-    public function customModuleVersion(): string
118
-    {
119
-        return '2.1.0-v.1';
120
-    }
121
-
122
-    /**
123
-     * {@inheritDoc}
124
-     * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes()
125
-     */
126
-    public function loadRoutes(Map $router): void
127
-    {
128
-        $router->attach('', '', static function (Map $router): void {
129
-
130
-            $router->attach('', '/module-maj/geodispersion', static function (Map $router): void {
131
-                $router->attach('', '/admin', static function (Map $router): void {
132
-                    $router->get(AdminConfigPage::class, '/config{/tree}', AdminConfigPage::class);
133
-
134
-                    $router->attach('', '/analysis-views/{tree}', static function (Map $router): void {
135
-                        $router->tokens(['view_id' => '\d+', 'enable' => '[01]']);
136
-                        $router->extras([
137
-                            'middleware' => [
138
-                                AuthManager::class,
139
-                            ],
140
-                        ]);
141
-                        $router->get(GeoAnalysisViewListData::class, '', GeoAnalysisViewListData::class);
142
-
143
-                        $router->get(GeoAnalysisViewAddPage::class, '/add', GeoAnalysisViewAddPage::class);
144
-                        $router->post(GeoAnalysisViewAddAction::class, '/add', GeoAnalysisViewAddAction::class);
145
-                        $router->get(GeoAnalysisViewEditPage::class, '/{view_id}', GeoAnalysisViewEditPage::class);
146
-                        $router->post(GeoAnalysisViewEditAction::class, '/{view_id}', GeoAnalysisViewEditAction::class);
147
-                        //phpcs:disable Generic.Files.LineLength.TooLong
148
-                        $router->get(GeoAnalysisViewStatusAction::class, '/{view_id}/status/{enable}', GeoAnalysisViewStatusAction::class);
149
-                        $router->get(GeoAnalysisViewDeleteAction::class, '/{view_id}/delete', GeoAnalysisViewDeleteAction::class);
150
-                        //phpcs:enable
151
-                    });
152
-
153
-                    $router->attach('', '/map-adapters/{tree}', static function (Map $router): void {
154
-                        $router->tokens(['adapter_id' => '\d+', 'view_id' => '\d+']);
155
-                        $router->extras([
156
-                            'middleware' => [
157
-                                AuthManager::class,
158
-                            ],
159
-                        ]);
160
-
161
-                        $router->get(MapAdapterAddPage::class, '/add/{view_id}', MapAdapterAddPage::class);
162
-                        $router->post(MapAdapterAddAction::class, '/add/{view_id}', MapAdapterAddAction::class);
163
-                        $router->get(MapAdapterEditPage::class, '/{adapter_id}', MapAdapterEditPage::class);
164
-                        $router->post(MapAdapterEditAction::class, '/{adapter_id}', MapAdapterEditAction::class);
165
-                        //phpcs:disable Generic.Files.LineLength.TooLong
166
-                        $router->get(MapAdapterDeleteAction::class, '/{adapter_id}/delete', MapAdapterDeleteAction::class);
167
-                        $router->get(MapAdapterMapperConfig::class, '/mapper/config{/adapter_id}', MapAdapterMapperConfig::class);
168
-                        //phpcs:enable
169
-                    });
170
-
171
-                    //phpcs:ignore Generic.Files.LineLength.TooLong
172
-                    $router->get(MapFeaturePropertyData::class, '/map/feature-properties{/map_id}', MapFeaturePropertyData::class);
173
-                });
174
-
175
-                $router->get(GeoAnalysisViewsList::class, '/list/{tree}', GeoAnalysisViewsList::class);
176
-
177
-                $router->attach('', '/analysisview/{tree}/{view_id}', static function (Map $router): void {
178
-                    $router->tokens(['view_id' => '\d+']);
179
-                    $router->get(GeoAnalysisViewPage::class, '', GeoAnalysisViewPage::class);
180
-                    $router->get(GeoAnalysisViewTabs::class, '/tabs', GeoAnalysisViewTabs::class);
181
-                });
182
-            });
183
-        });
184
-    }
185
-
186
-    public function getConfigLink(): string
187
-    {
188
-        return route(AdminConfigPage::class);
189
-    }
190
-
191
-    /**
192
-     * {@inheritDoc}
193
-     * @see \Fisharebest\Webtrees\Module\ModuleChartInterface::chartUrl()
194
-     */
195
-    public function chartUrl(Individual $individual, array $parameters = []): string
196
-    {
197
-        return route(GeoAnalysisViewsList::class, ['tree' => $individual->tree()->name()] + $parameters);
198
-    }
199
-
200
-    /**
201
-     * {@inheritDoc}
202
-     * @see \Fisharebest\Webtrees\Module\ModuleChartInterface::chartMenuClass()
203
-     */
204
-    public function chartMenuClass(): string
205
-    {
206
-        return 'menu-maj-geodispersion';
207
-    }
208
-
209
-    /**
210
-     * {@inheritDoc}
211
-     * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::headContent()
212
-     */
213
-    public function headContent(): string
214
-    {
215
-        return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">';
216
-    }
217
-
218
-    /**
219
-     * {@inheritDoc}
220
-     * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\ModulePlaceMapperProviderInterface::listPlaceMappers()
221
-     */
222
-    public function listPlaceMappers(): array
223
-    {
224
-        return [
225
-            CoordinatesPlaceMapper::class,
226
-            SimplePlaceMapper::class,
227
-            SimpleTopFilteredPlaceMapper::class
228
-        ];
229
-    }
230
-
231
-    /**
232
-     * {@inheritDoc}
233
-     * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\ModuleGeoAnalysisProviderInterface::listGeoAnalyses()
234
-     */
235
-    public function listGeoAnalyses(): array
236
-    {
237
-        return [
238
-            AllEventsByCenturyGeoAnalysis::class,
239
-            AllEventsByTypeGeoAnalysis::class
240
-        ];
241
-    }
68
+	use ModuleMyArtJaubTrait {
69
+		boot as traitBoot;
70
+	}
71
+	use ModuleChartTrait;
72
+	use ModuleConfigTrait;
73
+	use ModuleGlobalTrait;
74
+
75
+	// How to update the database schema for this module
76
+	private const SCHEMA_TARGET_VERSION   = 2;
77
+	private const SCHEMA_SETTING_NAME     = 'MAJ_GEODISP_SCHEMA_VERSION';
78
+	private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema';
79
+
80
+	/**
81
+	 * {@inheritDoc}
82
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::title()
83
+	 */
84
+	public function title(): string
85
+	{
86
+		return /* I18N: Name of the “GeoDispersion” module */ I18N::translate('Geographical Dispersion');
87
+	}
88
+
89
+	/**
90
+	 * {@inheritDoc}
91
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::description()
92
+	 */
93
+	public function description(): string
94
+	{
95
+		//phpcs:ignore Generic.Files.LineLength.TooLong
96
+		return /* I18N: Description of the “GeoDispersion” module */ I18N::translate('Perform and display geographical dispersion analysis');
97
+	}
98
+
99
+	/**
100
+	 * {@inheritDoc}
101
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::boot()
102
+	 */
103
+	public function boot(): void
104
+	{
105
+		$this->traitBoot();
106
+		app(MigrationService::class)->updateSchema(
107
+			self::SCHEMA_MIGRATION_PREFIX,
108
+			self::SCHEMA_SETTING_NAME,
109
+			self::SCHEMA_TARGET_VERSION
110
+		);
111
+	}
112
+
113
+	/**
114
+	 * {@inheritDoc}
115
+	 * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion()
116
+	 */
117
+	public function customModuleVersion(): string
118
+	{
119
+		return '2.1.0-v.1';
120
+	}
121
+
122
+	/**
123
+	 * {@inheritDoc}
124
+	 * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes()
125
+	 */
126
+	public function loadRoutes(Map $router): void
127
+	{
128
+		$router->attach('', '', static function (Map $router): void {
129
+
130
+			$router->attach('', '/module-maj/geodispersion', static function (Map $router): void {
131
+				$router->attach('', '/admin', static function (Map $router): void {
132
+					$router->get(AdminConfigPage::class, '/config{/tree}', AdminConfigPage::class);
133
+
134
+					$router->attach('', '/analysis-views/{tree}', static function (Map $router): void {
135
+						$router->tokens(['view_id' => '\d+', 'enable' => '[01]']);
136
+						$router->extras([
137
+							'middleware' => [
138
+								AuthManager::class,
139
+							],
140
+						]);
141
+						$router->get(GeoAnalysisViewListData::class, '', GeoAnalysisViewListData::class);
142
+
143
+						$router->get(GeoAnalysisViewAddPage::class, '/add', GeoAnalysisViewAddPage::class);
144
+						$router->post(GeoAnalysisViewAddAction::class, '/add', GeoAnalysisViewAddAction::class);
145
+						$router->get(GeoAnalysisViewEditPage::class, '/{view_id}', GeoAnalysisViewEditPage::class);
146
+						$router->post(GeoAnalysisViewEditAction::class, '/{view_id}', GeoAnalysisViewEditAction::class);
147
+						//phpcs:disable Generic.Files.LineLength.TooLong
148
+						$router->get(GeoAnalysisViewStatusAction::class, '/{view_id}/status/{enable}', GeoAnalysisViewStatusAction::class);
149
+						$router->get(GeoAnalysisViewDeleteAction::class, '/{view_id}/delete', GeoAnalysisViewDeleteAction::class);
150
+						//phpcs:enable
151
+					});
152
+
153
+					$router->attach('', '/map-adapters/{tree}', static function (Map $router): void {
154
+						$router->tokens(['adapter_id' => '\d+', 'view_id' => '\d+']);
155
+						$router->extras([
156
+							'middleware' => [
157
+								AuthManager::class,
158
+							],
159
+						]);
160
+
161
+						$router->get(MapAdapterAddPage::class, '/add/{view_id}', MapAdapterAddPage::class);
162
+						$router->post(MapAdapterAddAction::class, '/add/{view_id}', MapAdapterAddAction::class);
163
+						$router->get(MapAdapterEditPage::class, '/{adapter_id}', MapAdapterEditPage::class);
164
+						$router->post(MapAdapterEditAction::class, '/{adapter_id}', MapAdapterEditAction::class);
165
+						//phpcs:disable Generic.Files.LineLength.TooLong
166
+						$router->get(MapAdapterDeleteAction::class, '/{adapter_id}/delete', MapAdapterDeleteAction::class);
167
+						$router->get(MapAdapterMapperConfig::class, '/mapper/config{/adapter_id}', MapAdapterMapperConfig::class);
168
+						//phpcs:enable
169
+					});
170
+
171
+					//phpcs:ignore Generic.Files.LineLength.TooLong
172
+					$router->get(MapFeaturePropertyData::class, '/map/feature-properties{/map_id}', MapFeaturePropertyData::class);
173
+				});
174
+
175
+				$router->get(GeoAnalysisViewsList::class, '/list/{tree}', GeoAnalysisViewsList::class);
176
+
177
+				$router->attach('', '/analysisview/{tree}/{view_id}', static function (Map $router): void {
178
+					$router->tokens(['view_id' => '\d+']);
179
+					$router->get(GeoAnalysisViewPage::class, '', GeoAnalysisViewPage::class);
180
+					$router->get(GeoAnalysisViewTabs::class, '/tabs', GeoAnalysisViewTabs::class);
181
+				});
182
+			});
183
+		});
184
+	}
185
+
186
+	public function getConfigLink(): string
187
+	{
188
+		return route(AdminConfigPage::class);
189
+	}
190
+
191
+	/**
192
+	 * {@inheritDoc}
193
+	 * @see \Fisharebest\Webtrees\Module\ModuleChartInterface::chartUrl()
194
+	 */
195
+	public function chartUrl(Individual $individual, array $parameters = []): string
196
+	{
197
+		return route(GeoAnalysisViewsList::class, ['tree' => $individual->tree()->name()] + $parameters);
198
+	}
199
+
200
+	/**
201
+	 * {@inheritDoc}
202
+	 * @see \Fisharebest\Webtrees\Module\ModuleChartInterface::chartMenuClass()
203
+	 */
204
+	public function chartMenuClass(): string
205
+	{
206
+		return 'menu-maj-geodispersion';
207
+	}
208
+
209
+	/**
210
+	 * {@inheritDoc}
211
+	 * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::headContent()
212
+	 */
213
+	public function headContent(): string
214
+	{
215
+		return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">';
216
+	}
217
+
218
+	/**
219
+	 * {@inheritDoc}
220
+	 * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\ModulePlaceMapperProviderInterface::listPlaceMappers()
221
+	 */
222
+	public function listPlaceMappers(): array
223
+	{
224
+		return [
225
+			CoordinatesPlaceMapper::class,
226
+			SimplePlaceMapper::class,
227
+			SimpleTopFilteredPlaceMapper::class
228
+		];
229
+	}
230
+
231
+	/**
232
+	 * {@inheritDoc}
233
+	 * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\ModuleGeoAnalysisProviderInterface::listGeoAnalyses()
234
+	 */
235
+	public function listGeoAnalyses(): array
236
+	{
237
+		return [
238
+			AllEventsByCenturyGeoAnalysis::class,
239
+			AllEventsByTypeGeoAnalysis::class
240
+		];
241
+	}
242 242
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     // How to update the database schema for this module
76 76
     private const SCHEMA_TARGET_VERSION   = 2;
77 77
     private const SCHEMA_SETTING_NAME     = 'MAJ_GEODISP_SCHEMA_VERSION';
78
-    private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema';
78
+    private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__.'\Schema';
79 79
 
80 80
     /**
81 81
      * {@inheritDoc}
@@ -125,13 +125,13 @@  discard block
 block discarded – undo
125 125
      */
126 126
     public function loadRoutes(Map $router): void
127 127
     {
128
-        $router->attach('', '', static function (Map $router): void {
128
+        $router->attach('', '', static function(Map $router): void {
129 129
 
130
-            $router->attach('', '/module-maj/geodispersion', static function (Map $router): void {
131
-                $router->attach('', '/admin', static function (Map $router): void {
130
+            $router->attach('', '/module-maj/geodispersion', static function(Map $router): void {
131
+                $router->attach('', '/admin', static function(Map $router): void {
132 132
                     $router->get(AdminConfigPage::class, '/config{/tree}', AdminConfigPage::class);
133 133
 
134
-                    $router->attach('', '/analysis-views/{tree}', static function (Map $router): void {
134
+                    $router->attach('', '/analysis-views/{tree}', static function(Map $router): void {
135 135
                         $router->tokens(['view_id' => '\d+', 'enable' => '[01]']);
136 136
                         $router->extras([
137 137
                             'middleware' => [
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
                         //phpcs:enable
151 151
                     });
152 152
 
153
-                    $router->attach('', '/map-adapters/{tree}', static function (Map $router): void {
153
+                    $router->attach('', '/map-adapters/{tree}', static function(Map $router): void {
154 154
                         $router->tokens(['adapter_id' => '\d+', 'view_id' => '\d+']);
155 155
                         $router->extras([
156 156
                             'middleware' => [
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 
175 175
                 $router->get(GeoAnalysisViewsList::class, '/list/{tree}', GeoAnalysisViewsList::class);
176 176
 
177
-                $router->attach('', '/analysisview/{tree}/{view_id}', static function (Map $router): void {
177
+                $router->attach('', '/analysisview/{tree}/{view_id}', static function(Map $router): void {
178 178
                     $router->tokens(['view_id' => '\d+']);
179 179
                     $router->get(GeoAnalysisViewPage::class, '', GeoAnalysisViewPage::class);
180 180
                     $router->get(GeoAnalysisViewTabs::class, '/tabs', GeoAnalysisViewTabs::class);
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
      */
213 213
     public function headContent(): string
214 214
     {
215
-        return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">';
215
+        return '<link rel="stylesheet" href="'.e($this->moduleCssUrl()).'">';
216 216
     }
217 217
 
218 218
     /**
Please login to merge, or discard this patch.
Module/GeoDispersion/Http/RequestHandlers/GeoAnalysisViewEditPage.php 2 patches
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -38,64 +38,64 @@
 block discarded – undo
38 38
  */
39 39
 class GeoAnalysisViewEditPage implements RequestHandlerInterface
40 40
 {
41
-    use ViewResponseTrait;
41
+	use ViewResponseTrait;
42 42
 
43
-    private ?GeoDispersionModule $module;
44
-    private GeoAnalysisViewDataService $geoview_data_service;
45
-    private GeoAnalysisService $geoanalysis_service;
46
-    private GeoAnalysisDataService $geoanalysis_data_service;
43
+	private ?GeoDispersionModule $module;
44
+	private GeoAnalysisViewDataService $geoview_data_service;
45
+	private GeoAnalysisService $geoanalysis_service;
46
+	private GeoAnalysisDataService $geoanalysis_data_service;
47 47
 
48
-    /**
49
-     * Constructor for GeoAnalysisViewEditPage Request Handler
50
-     *
51
-     * @param ModuleService $module_service
52
-     * @param GeoAnalysisViewDataService $geoview_data_service
53
-     * @param GeoAnalysisService $geoanalysis_service
54
-     * @param GeoAnalysisDataService $geoanalysis_data_service
55
-     */
56
-    public function __construct(
57
-        ModuleService $module_service,
58
-        GeoAnalysisViewDataService $geoview_data_service,
59
-        GeoAnalysisService $geoanalysis_service,
60
-        GeoAnalysisDataService $geoanalysis_data_service
61
-    ) {
62
-        $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
63
-        $this->geoview_data_service = $geoview_data_service;
64
-        $this->geoanalysis_service = $geoanalysis_service;
65
-        $this->geoanalysis_data_service = $geoanalysis_data_service;
66
-    }
48
+	/**
49
+	 * Constructor for GeoAnalysisViewEditPage Request Handler
50
+	 *
51
+	 * @param ModuleService $module_service
52
+	 * @param GeoAnalysisViewDataService $geoview_data_service
53
+	 * @param GeoAnalysisService $geoanalysis_service
54
+	 * @param GeoAnalysisDataService $geoanalysis_data_service
55
+	 */
56
+	public function __construct(
57
+		ModuleService $module_service,
58
+		GeoAnalysisViewDataService $geoview_data_service,
59
+		GeoAnalysisService $geoanalysis_service,
60
+		GeoAnalysisDataService $geoanalysis_data_service
61
+	) {
62
+		$this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
63
+		$this->geoview_data_service = $geoview_data_service;
64
+		$this->geoanalysis_service = $geoanalysis_service;
65
+		$this->geoanalysis_data_service = $geoanalysis_data_service;
66
+	}
67 67
 
68
-    /**
69
-     * {@inheritDoc}
70
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
71
-     */
72
-    public function handle(ServerRequestInterface $request): ResponseInterface
73
-    {
74
-        $this->layout = 'layouts/administration';
68
+	/**
69
+	 * {@inheritDoc}
70
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
71
+	 */
72
+	public function handle(ServerRequestInterface $request): ResponseInterface
73
+	{
74
+		$this->layout = 'layouts/administration';
75 75
 
76
-        if ($this->module === null) {
77
-            throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
78
-        }
79
-        $tree = $request->getAttribute('tree');
80
-        assert($tree instanceof Tree);
76
+		if ($this->module === null) {
77
+			throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
78
+		}
79
+		$tree = $request->getAttribute('tree');
80
+		assert($tree instanceof Tree);
81 81
 
82
-        $view_id = (int) $request->getAttribute('view_id');
83
-        $view = $this->geoview_data_service->find($tree, $view_id, true);
82
+		$view_id = (int) $request->getAttribute('view_id');
83
+		$view = $this->geoview_data_service->find($tree, $view_id, true);
84 84
 
85
-        if ($view === null) {
86
-            throw new HttpNotFoundException(
87
-                I18N::translate('The geographical dispersion analysis view could not be found.')
88
-            );
89
-        }
85
+		if ($view === null) {
86
+			throw new HttpNotFoundException(
87
+				I18N::translate('The geographical dispersion analysis view could not be found.')
88
+			);
89
+		}
90 90
 
91
-        return $this->viewResponse($this->module->name() . '::admin/view-edit', [
92
-            'module'        =>  $this->module,
93
-            'title'         =>  I18N::translate('Edit the geographical dispersion analysis view - %s', $view->type()),
94
-            'tree'          =>  $tree,
95
-            'view'          =>  $view,
96
-            'geoanalysis_list'  =>  $this->geoanalysis_service->all(),
97
-            'place_example'     =>  $this->geoanalysis_data_service->placeHierarchyExample($tree),
98
-            'global_settings'   =>  $view->globalSettingsContent($this->module)
99
-        ]);
100
-    }
91
+		return $this->viewResponse($this->module->name() . '::admin/view-edit', [
92
+			'module'        =>  $this->module,
93
+			'title'         =>  I18N::translate('Edit the geographical dispersion analysis view - %s', $view->type()),
94
+			'tree'          =>  $tree,
95
+			'view'          =>  $view,
96
+			'geoanalysis_list'  =>  $this->geoanalysis_service->all(),
97
+			'place_example'     =>  $this->geoanalysis_data_service->placeHierarchyExample($tree),
98
+			'global_settings'   =>  $view->globalSettingsContent($this->module)
99
+		]);
100
+	}
101 101
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         $tree = $request->getAttribute('tree');
80 80
         assert($tree instanceof Tree);
81 81
 
82
-        $view_id = (int) $request->getAttribute('view_id');
82
+        $view_id = (int)$request->getAttribute('view_id');
83 83
         $view = $this->geoview_data_service->find($tree, $view_id, true);
84 84
 
85 85
         if ($view === null) {
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
             );
89 89
         }
90 90
 
91
-        return $this->viewResponse($this->module->name() . '::admin/view-edit', [
91
+        return $this->viewResponse($this->module->name().'::admin/view-edit', [
92 92
             'module'        =>  $this->module,
93 93
             'title'         =>  I18N::translate('Edit the geographical dispersion analysis view - %s', $view->type()),
94 94
             'tree'          =>  $tree,
Please login to merge, or discard this patch.
Module/GeoDispersion/Http/RequestHandlers/GeoAnalysisViewEditAction.php 2 patches
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -33,88 +33,88 @@
 block discarded – undo
33 33
  */
34 34
 class GeoAnalysisViewEditAction implements RequestHandlerInterface
35 35
 {
36
-    private ?GeoDispersionModule $module;
37
-    private GeoAnalysisViewDataService $geoview_data_service;
38
-
39
-    /**
40
-     * Constructor for GeoAnalysisViewEditAction Request Handler
41
-     *
42
-     * @param ModuleService $module_service
43
-     * @param GeoAnalysisViewDataService $geoview_data_service
44
-     */
45
-    public function __construct(ModuleService $module_service, GeoAnalysisViewDataService $geoview_data_service)
46
-    {
47
-        $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
48
-        $this->geoview_data_service = $geoview_data_service;
49
-    }
50
-
51
-    /**
52
-     * {@inheritDoc}
53
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
54
-     */
55
-    public function handle(ServerRequestInterface $request): ResponseInterface
56
-    {
57
-        $tree = $request->getAttribute('tree');
58
-        assert($tree instanceof Tree);
59
-
60
-        $admin_config_route = route(AdminConfigPage::class, ['tree' => $tree->name()]);
61
-
62
-        if ($this->module === null) {
63
-            FlashMessages::addMessage(
64
-                I18N::translate('The attached module could not be found.'),
65
-                'danger'
66
-            );
67
-            return redirect($admin_config_route);
68
-        }
69
-
70
-
71
-        $view_id = (int) $request->getAttribute('view_id');
72
-        $view = $this->geoview_data_service->find($tree, $view_id, true);
73
-
74
-        $params = (array) $request->getParsedBody();
75
-
76
-        $description    = $params['view_description'] ?? '';
77
-        $place_depth    = (int) ($params['view_depth'] ?? 1);
78
-        $top_places     = (int) ($params['view_top_places'] ?? 0);
79
-
80
-        $analysis = null;
81
-        try {
82
-            $analysis = app($params['view_analysis'] ?? '');
83
-        } catch (BindingResolutionException $ex) {
84
-        }
85
-
86
-        if (
87
-            $view === null
88
-            || $analysis === null || !($analysis instanceof GeoAnalysisInterface)
89
-            || $place_depth <= 0 && $top_places < 0
90
-        ) {
91
-            FlashMessages::addMessage(
92
-                I18N::translate('The parameters for view with ID “%d” are not valid.', I18N::number($view_id)),
93
-                'danger'
94
-            );
95
-            return redirect($admin_config_route);
96
-        }
97
-
98
-        $new_view = $view
99
-            ->with($view->isEnabled(), $description, $analysis, $place_depth, $top_places)
100
-            ->withGlobalSettingsUpdate($request);
101
-
102
-        if ($this->geoview_data_service->update($new_view) > 0) {
103
-            FlashMessages::addMessage(
104
-                I18N::translate('The geographical dispersion analysis view has been successfully updated'),
105
-                'success'
106
-            );
107
-            //phpcs:ignore Generic.Files.LineLength.TooLong
108
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been updated.');
109
-        } else {
110
-            FlashMessages::addMessage(
111
-                I18N::translate('An error occured while updating the geographical dispersion analysis view'),
112
-                'danger'
113
-            );
114
-            //phpcs:ignore Generic.Files.LineLength.TooLong
115
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” could not be updated. See error log.');
116
-        }
117
-
118
-        return redirect($admin_config_route);
119
-    }
36
+	private ?GeoDispersionModule $module;
37
+	private GeoAnalysisViewDataService $geoview_data_service;
38
+
39
+	/**
40
+	 * Constructor for GeoAnalysisViewEditAction Request Handler
41
+	 *
42
+	 * @param ModuleService $module_service
43
+	 * @param GeoAnalysisViewDataService $geoview_data_service
44
+	 */
45
+	public function __construct(ModuleService $module_service, GeoAnalysisViewDataService $geoview_data_service)
46
+	{
47
+		$this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
48
+		$this->geoview_data_service = $geoview_data_service;
49
+	}
50
+
51
+	/**
52
+	 * {@inheritDoc}
53
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
54
+	 */
55
+	public function handle(ServerRequestInterface $request): ResponseInterface
56
+	{
57
+		$tree = $request->getAttribute('tree');
58
+		assert($tree instanceof Tree);
59
+
60
+		$admin_config_route = route(AdminConfigPage::class, ['tree' => $tree->name()]);
61
+
62
+		if ($this->module === null) {
63
+			FlashMessages::addMessage(
64
+				I18N::translate('The attached module could not be found.'),
65
+				'danger'
66
+			);
67
+			return redirect($admin_config_route);
68
+		}
69
+
70
+
71
+		$view_id = (int) $request->getAttribute('view_id');
72
+		$view = $this->geoview_data_service->find($tree, $view_id, true);
73
+
74
+		$params = (array) $request->getParsedBody();
75
+
76
+		$description    = $params['view_description'] ?? '';
77
+		$place_depth    = (int) ($params['view_depth'] ?? 1);
78
+		$top_places     = (int) ($params['view_top_places'] ?? 0);
79
+
80
+		$analysis = null;
81
+		try {
82
+			$analysis = app($params['view_analysis'] ?? '');
83
+		} catch (BindingResolutionException $ex) {
84
+		}
85
+
86
+		if (
87
+			$view === null
88
+			|| $analysis === null || !($analysis instanceof GeoAnalysisInterface)
89
+			|| $place_depth <= 0 && $top_places < 0
90
+		) {
91
+			FlashMessages::addMessage(
92
+				I18N::translate('The parameters for view with ID “%d” are not valid.', I18N::number($view_id)),
93
+				'danger'
94
+			);
95
+			return redirect($admin_config_route);
96
+		}
97
+
98
+		$new_view = $view
99
+			->with($view->isEnabled(), $description, $analysis, $place_depth, $top_places)
100
+			->withGlobalSettingsUpdate($request);
101
+
102
+		if ($this->geoview_data_service->update($new_view) > 0) {
103
+			FlashMessages::addMessage(
104
+				I18N::translate('The geographical dispersion analysis view has been successfully updated'),
105
+				'success'
106
+			);
107
+			//phpcs:ignore Generic.Files.LineLength.TooLong
108
+			Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been updated.');
109
+		} else {
110
+			FlashMessages::addMessage(
111
+				I18N::translate('An error occured while updating the geographical dispersion analysis view'),
112
+				'danger'
113
+			);
114
+			//phpcs:ignore Generic.Files.LineLength.TooLong
115
+			Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” could not be updated. See error log.');
116
+		}
117
+
118
+		return redirect($admin_config_route);
119
+	}
120 120
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -68,14 +68,14 @@  discard block
 block discarded – undo
68 68
         }
69 69
 
70 70
 
71
-        $view_id = (int) $request->getAttribute('view_id');
71
+        $view_id = (int)$request->getAttribute('view_id');
72 72
         $view = $this->geoview_data_service->find($tree, $view_id, true);
73 73
 
74
-        $params = (array) $request->getParsedBody();
74
+        $params = (array)$request->getParsedBody();
75 75
 
76 76
         $description    = $params['view_description'] ?? '';
77
-        $place_depth    = (int) ($params['view_depth'] ?? 1);
78
-        $top_places     = (int) ($params['view_top_places'] ?? 0);
77
+        $place_depth    = (int)($params['view_depth'] ?? 1);
78
+        $top_places     = (int)($params['view_top_places'] ?? 0);
79 79
 
80 80
         $analysis = null;
81 81
         try {
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
                 'success'
106 106
             );
107 107
             //phpcs:ignore Generic.Files.LineLength.TooLong
108
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been updated.');
108
+            Log::addConfigurationLog('Module '.$this->module->title().' : View “'.$view->id().'” has been updated.');
109 109
         } else {
110 110
             FlashMessages::addMessage(
111 111
                 I18N::translate('An error occured while updating the geographical dispersion analysis view'),
112 112
                 'danger'
113 113
             );
114 114
             //phpcs:ignore Generic.Files.LineLength.TooLong
115
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” could not be updated. See error log.');
115
+            Log::addConfigurationLog('Module '.$this->module->title().' : View “'.$view->id().'” could not be updated. See error log.');
116 116
         }
117 117
 
118 118
         return redirect($admin_config_route);
Please login to merge, or discard this patch.
Module/GeoDispersion/Http/RequestHandlers/MapAdapterMapperConfig.php 2 patches
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -32,68 +32,68 @@
 block discarded – undo
32 32
  */
33 33
 class MapAdapterMapperConfig implements RequestHandlerInterface
34 34
 {
35
-    use ViewResponseTrait;
35
+	use ViewResponseTrait;
36 36
 
37
-    private ?GeoDispersionModule $module;
38
-    private MapAdapterDataService $mapadapter_data_service;
37
+	private ?GeoDispersionModule $module;
38
+	private MapAdapterDataService $mapadapter_data_service;
39 39
 
40
-    /**
41
-     * Constructor for MapAdapterMapperConfig Request Handler
42
-     *
43
-     * @param ModuleService $module_service
44
-     * @param MapAdapterDataService $mapadapter_data_service
45
-     */
46
-    public function __construct(
47
-        ModuleService $module_service,
48
-        MapAdapterDataService $mapadapter_data_service
49
-    ) {
50
-        $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
51
-        $this->mapadapter_data_service = $mapadapter_data_service;
52
-    }
40
+	/**
41
+	 * Constructor for MapAdapterMapperConfig Request Handler
42
+	 *
43
+	 * @param ModuleService $module_service
44
+	 * @param MapAdapterDataService $mapadapter_data_service
45
+	 */
46
+	public function __construct(
47
+		ModuleService $module_service,
48
+		MapAdapterDataService $mapadapter_data_service
49
+	) {
50
+		$this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
51
+		$this->mapadapter_data_service = $mapadapter_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
-        $this->layout = 'layouts/ajax';
54
+	/**
55
+	 * {@inheritDoc}
56
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
57
+	 */
58
+	public function handle(ServerRequestInterface $request): ResponseInterface
59
+	{
60
+		$this->layout = 'layouts/ajax';
61 61
 
62
-        if ($this->module === null) {
63
-            throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
64
-        }
65
-        $tree = $request->getAttribute('tree');
66
-        assert($tree instanceof Tree);
62
+		if ($this->module === null) {
63
+			throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
64
+		}
65
+		$tree = $request->getAttribute('tree');
66
+		assert($tree instanceof Tree);
67 67
 
68
-        $adapter_id = (int) $request->getAttribute('adapter_id');
69
-        $map_adapter = $this->mapadapter_data_service->find($adapter_id);
68
+		$adapter_id = (int) $request->getAttribute('adapter_id');
69
+		$map_adapter = $this->mapadapter_data_service->find($adapter_id);
70 70
 
71
-        $mapper_class = $request->getQueryParams()['mapper'] ?? '';
72
-        $mapper = null;
73
-        if ($mapper_class === '' && $map_adapter !== null) {
74
-            $mapper = $map_adapter->placeMapper();
75
-        } else {
76
-            try {
77
-                $mapper = app($mapper_class);
78
-            } catch (BindingResolutionException $ex) {
79
-            }
71
+		$mapper_class = $request->getQueryParams()['mapper'] ?? '';
72
+		$mapper = null;
73
+		if ($mapper_class === '' && $map_adapter !== null) {
74
+			$mapper = $map_adapter->placeMapper();
75
+		} else {
76
+			try {
77
+				$mapper = app($mapper_class);
78
+			} catch (BindingResolutionException $ex) {
79
+			}
80 80
 
81
-            if (
82
-                $mapper !== null && $map_adapter !== null &&
83
-                get_class($map_adapter->placeMapper()) === get_class($mapper)
84
-            ) {
85
-                $mapper = $map_adapter->placeMapper();
86
-            }
87
-        }
81
+			if (
82
+				$mapper !== null && $map_adapter !== null &&
83
+				get_class($map_adapter->placeMapper()) === get_class($mapper)
84
+			) {
85
+				$mapper = $map_adapter->placeMapper();
86
+			}
87
+		}
88 88
 
89
-        if ($mapper === null || !($mapper instanceof PlaceMapperInterface)) {
90
-            throw new HttpNotFoundException(
91
-                I18N::translate('The configuration for the place mapper could not be found.')
92
-            );
93
-        }
89
+		if ($mapper === null || !($mapper instanceof PlaceMapperInterface)) {
90
+			throw new HttpNotFoundException(
91
+				I18N::translate('The configuration for the place mapper could not be found.')
92
+			);
93
+		}
94 94
 
95
-        return $this->viewResponse('layouts/ajax', [
96
-            'content' => $mapper->config()->configContent($this->module, $tree)
97
-        ]);
98
-    }
95
+		return $this->viewResponse('layouts/ajax', [
96
+			'content' => $mapper->config()->configContent($this->module, $tree)
97
+		]);
98
+	}
99 99
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
         $tree = $request->getAttribute('tree');
66 66
         assert($tree instanceof Tree);
67 67
 
68
-        $adapter_id = (int) $request->getAttribute('adapter_id');
68
+        $adapter_id = (int)$request->getAttribute('adapter_id');
69 69
         $map_adapter = $this->mapadapter_data_service->find($adapter_id);
70 70
 
71 71
         $mapper_class = $request->getQueryParams()['mapper'] ?? '';
Please login to merge, or discard this patch.
Module/GeoDispersion/Http/RequestHandlers/GeoAnalysisViewAddPage.php 2 patches
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -31,49 +31,49 @@
 block discarded – undo
31 31
  */
32 32
 class GeoAnalysisViewAddPage implements RequestHandlerInterface
33 33
 {
34
-    use ViewResponseTrait;
34
+	use ViewResponseTrait;
35 35
 
36
-    private ?GeoDispersionModule $module;
37
-    private GeoAnalysisService $geoanalysis_service;
38
-    private GeoAnalysisDataService $geoanalysis_data_service;
36
+	private ?GeoDispersionModule $module;
37
+	private GeoAnalysisService $geoanalysis_service;
38
+	private GeoAnalysisDataService $geoanalysis_data_service;
39 39
 
40
-    /**
41
-     * Constructor for GeoAnalysisViewAddPage Request Handler
42
-     *
43
-     * @param ModuleService $module_service
44
-     * @param GeoAnalysisService $geoanalysis_service
45
-     * @param GeoAnalysisDataService $geoanalysis_data_service
46
-     */
47
-    public function __construct(
48
-        ModuleService $module_service,
49
-        GeoAnalysisService $geoanalysis_service,
50
-        GeoAnalysisDataService $geoanalysis_data_service
51
-    ) {
52
-        $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
53
-        $this->geoanalysis_service = $geoanalysis_service;
54
-        $this->geoanalysis_data_service = $geoanalysis_data_service;
55
-    }
40
+	/**
41
+	 * Constructor for GeoAnalysisViewAddPage Request Handler
42
+	 *
43
+	 * @param ModuleService $module_service
44
+	 * @param GeoAnalysisService $geoanalysis_service
45
+	 * @param GeoAnalysisDataService $geoanalysis_data_service
46
+	 */
47
+	public function __construct(
48
+		ModuleService $module_service,
49
+		GeoAnalysisService $geoanalysis_service,
50
+		GeoAnalysisDataService $geoanalysis_data_service
51
+	) {
52
+		$this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
53
+		$this->geoanalysis_service = $geoanalysis_service;
54
+		$this->geoanalysis_data_service = $geoanalysis_data_service;
55
+	}
56 56
 
57
-    /**
58
-     * {@inheritDoc}
59
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
60
-     */
61
-    public function handle(ServerRequestInterface $request): ResponseInterface
62
-    {
63
-        $this->layout = 'layouts/administration';
57
+	/**
58
+	 * {@inheritDoc}
59
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
60
+	 */
61
+	public function handle(ServerRequestInterface $request): ResponseInterface
62
+	{
63
+		$this->layout = 'layouts/administration';
64 64
 
65
-        if ($this->module === null) {
66
-            throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
67
-        }
68
-        $tree = $request->getAttribute('tree');
69
-        assert($tree instanceof Tree);
65
+		if ($this->module === null) {
66
+			throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
67
+		}
68
+		$tree = $request->getAttribute('tree');
69
+		assert($tree instanceof 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.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
         $tree = $request->getAttribute('tree');
69 69
         assert($tree instanceof Tree);
70 70
 
71
-        return $this->viewResponse($this->module->name() . '::admin/view-add', [
71
+        return $this->viewResponse($this->module->name().'::admin/view-add', [
72 72
             'module'        =>  $this->module,
73 73
             'title'         =>  I18N::translate('Add a geographical dispersion analysis view'),
74 74
             'tree'          =>  $tree,
Please login to merge, or discard this patch.
Module/GeoDispersion/Http/RequestHandlers/GeoAnalysisViewAddAction.php 2 patches
Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -34,89 +34,89 @@
 block discarded – undo
34 34
  */
35 35
 class GeoAnalysisViewAddAction implements RequestHandlerInterface
36 36
 {
37
-    private ?GeoDispersionModule $module;
38
-    private GeoAnalysisViewDataService $geoview_data_service;
39
-
40
-    /**
41
-     * Constructor for GeoAnalysisViewAddAction 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 = $request->getAttribute('tree');
59
-        assert($tree instanceof Tree);
60
-
61
-        $admin_config_route = route(AdminConfigPage::class, ['tree' => $tree->name()]);
62
-
63
-        if ($this->module === null) {
64
-            FlashMessages::addMessage(
65
-                I18N::translate('The attached module could not be found.'),
66
-                'danger'
67
-            );
68
-            return redirect($admin_config_route);
69
-        }
70
-
71
-
72
-        $params = (array) $request->getParsedBody();
73
-
74
-        $type           = $params['view_type'] ?? '';
75
-        $description    = $params['view_description'] ?? '';
76
-        $place_depth    = (int) ($params['view_depth'] ?? 1);
77
-
78
-        $analysis = null;
79
-        try {
80
-            $analysis = app($params['view_analysis'] ?? '');
81
-        } catch (BindingResolutionException $ex) {
82
-        }
83
-
84
-        if (
85
-            !in_array($type, ['table', 'map']) || $place_depth <= 0
86
-            || $analysis === null || !($analysis instanceof GeoAnalysisInterface)
87
-        ) {
88
-            FlashMessages::addMessage(
89
-                I18N::translate('The parameters for the new view are not valid.'),
90
-                'danger'
91
-            );
92
-            return redirect($admin_config_route);
93
-        }
94
-
95
-        if ($type === 'map') {
96
-            $new_view = new GeoAnalysisMap(0, $tree, true, $description, $analysis, $place_depth);
97
-        } else {
98
-            $new_view = new GeoAnalysisTable(0, $tree, true, $description, $analysis, $place_depth);
99
-        }
100
-
101
-        $new_view_id = $this->geoview_data_service->insertGetId($new_view);
102
-        if ($new_view_id > 0) {
103
-            FlashMessages::addMessage(
104
-                I18N::translate('The geographical dispersion analysis view has been successfully added'),
105
-                'success'
106
-            );
107
-            //phpcs:ignore Generic.Files.LineLength.TooLong
108
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $new_view_id . '” has been added.');
109
-            return redirect(
110
-                route(GeoAnalysisViewEditPage::class, ['tree' => $tree->name(), 'view_id' => $new_view_id ])
111
-            );
112
-        } else {
113
-            FlashMessages::addMessage(
114
-                I18N::translate('An error occured while adding the geographical dispersion analysis view'),
115
-                'danger'
116
-            );
117
-            //phpcs:ignore Generic.Files.LineLength.TooLong
118
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : A new View could not be added. See error log.');
119
-            return redirect($admin_config_route);
120
-        }
121
-    }
37
+	private ?GeoDispersionModule $module;
38
+	private GeoAnalysisViewDataService $geoview_data_service;
39
+
40
+	/**
41
+	 * Constructor for GeoAnalysisViewAddAction 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 = $request->getAttribute('tree');
59
+		assert($tree instanceof Tree);
60
+
61
+		$admin_config_route = route(AdminConfigPage::class, ['tree' => $tree->name()]);
62
+
63
+		if ($this->module === null) {
64
+			FlashMessages::addMessage(
65
+				I18N::translate('The attached module could not be found.'),
66
+				'danger'
67
+			);
68
+			return redirect($admin_config_route);
69
+		}
70
+
71
+
72
+		$params = (array) $request->getParsedBody();
73
+
74
+		$type           = $params['view_type'] ?? '';
75
+		$description    = $params['view_description'] ?? '';
76
+		$place_depth    = (int) ($params['view_depth'] ?? 1);
77
+
78
+		$analysis = null;
79
+		try {
80
+			$analysis = app($params['view_analysis'] ?? '');
81
+		} catch (BindingResolutionException $ex) {
82
+		}
83
+
84
+		if (
85
+			!in_array($type, ['table', 'map']) || $place_depth <= 0
86
+			|| $analysis === null || !($analysis instanceof GeoAnalysisInterface)
87
+		) {
88
+			FlashMessages::addMessage(
89
+				I18N::translate('The parameters for the new view are not valid.'),
90
+				'danger'
91
+			);
92
+			return redirect($admin_config_route);
93
+		}
94
+
95
+		if ($type === 'map') {
96
+			$new_view = new GeoAnalysisMap(0, $tree, true, $description, $analysis, $place_depth);
97
+		} else {
98
+			$new_view = new GeoAnalysisTable(0, $tree, true, $description, $analysis, $place_depth);
99
+		}
100
+
101
+		$new_view_id = $this->geoview_data_service->insertGetId($new_view);
102
+		if ($new_view_id > 0) {
103
+			FlashMessages::addMessage(
104
+				I18N::translate('The geographical dispersion analysis view has been successfully added'),
105
+				'success'
106
+			);
107
+			//phpcs:ignore Generic.Files.LineLength.TooLong
108
+			Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $new_view_id . '” has been added.');
109
+			return redirect(
110
+				route(GeoAnalysisViewEditPage::class, ['tree' => $tree->name(), 'view_id' => $new_view_id ])
111
+			);
112
+		} else {
113
+			FlashMessages::addMessage(
114
+				I18N::translate('An error occured while adding the geographical dispersion analysis view'),
115
+				'danger'
116
+			);
117
+			//phpcs:ignore Generic.Files.LineLength.TooLong
118
+			Log::addConfigurationLog('Module ' . $this->module->title() . ' : A new View could not be added. See error log.');
119
+			return redirect($admin_config_route);
120
+		}
121
+	}
122 122
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -69,11 +69,11 @@  discard block
 block discarded – undo
69 69
         }
70 70
 
71 71
 
72
-        $params = (array) $request->getParsedBody();
72
+        $params = (array)$request->getParsedBody();
73 73
 
74 74
         $type           = $params['view_type'] ?? '';
75 75
         $description    = $params['view_description'] ?? '';
76
-        $place_depth    = (int) ($params['view_depth'] ?? 1);
76
+        $place_depth    = (int)($params['view_depth'] ?? 1);
77 77
 
78 78
         $analysis = null;
79 79
         try {
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
                 'success'
106 106
             );
107 107
             //phpcs:ignore Generic.Files.LineLength.TooLong
108
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $new_view_id . '” has been added.');
108
+            Log::addConfigurationLog('Module '.$this->module->title().' : View “'.$new_view_id.'” has been added.');
109 109
             return redirect(
110
-                route(GeoAnalysisViewEditPage::class, ['tree' => $tree->name(), 'view_id' => $new_view_id ])
110
+                route(GeoAnalysisViewEditPage::class, ['tree' => $tree->name(), 'view_id' => $new_view_id])
111 111
             );
112 112
         } else {
113 113
             FlashMessages::addMessage(
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
                 'danger'
116 116
             );
117 117
             //phpcs:ignore Generic.Files.LineLength.TooLong
118
-            Log::addConfigurationLog('Module ' . $this->module->title() . ' : A new View could not be added. See error log.');
118
+            Log::addConfigurationLog('Module '.$this->module->title().' : A new View could not be added. See error log.');
119 119
             return redirect($admin_config_route);
120 120
         }
121 121
     }
Please login to merge, or discard this patch.
Webtrees/Module/GeoDispersion/Http/RequestHandlers/MapAdapterEditPage.php 2 patches
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -32,68 +32,68 @@
 block discarded – undo
32 32
  */
33 33
 class MapAdapterEditPage implements RequestHandlerInterface
34 34
 {
35
-    use ViewResponseTrait;
35
+	use ViewResponseTrait;
36 36
 
37
-    private ?GeoDispersionModule $module;
38
-    private MapAdapterDataService $mapadapter_data_service;
39
-    private MapDefinitionsService $map_definition_service;
40
-    private PlaceMapperService $place_mapper_service;
37
+	private ?GeoDispersionModule $module;
38
+	private MapAdapterDataService $mapadapter_data_service;
39
+	private MapDefinitionsService $map_definition_service;
40
+	private PlaceMapperService $place_mapper_service;
41 41
 
42
-    /**
43
-     * Constructor for MapAdapterEditPage Request Handler
44
-     *
45
-     * @param ModuleService $module_service
46
-     * @param MapAdapterDataService $mapadapter_data_service
47
-     * @param MapDefinitionsService $map_definition_service
48
-     * @param PlaceMapperService $place_mapper_service
49
-     */
50
-    public function __construct(
51
-        ModuleService $module_service,
52
-        MapAdapterDataService $mapadapter_data_service,
53
-        MapDefinitionsService $map_definition_service,
54
-        PlaceMapperService $place_mapper_service
55
-    ) {
56
-        $this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
57
-        $this->mapadapter_data_service = $mapadapter_data_service;
58
-        $this->map_definition_service = $map_definition_service;
59
-        $this->place_mapper_service = $place_mapper_service;
60
-    }
42
+	/**
43
+	 * Constructor for MapAdapterEditPage Request Handler
44
+	 *
45
+	 * @param ModuleService $module_service
46
+	 * @param MapAdapterDataService $mapadapter_data_service
47
+	 * @param MapDefinitionsService $map_definition_service
48
+	 * @param PlaceMapperService $place_mapper_service
49
+	 */
50
+	public function __construct(
51
+		ModuleService $module_service,
52
+		MapAdapterDataService $mapadapter_data_service,
53
+		MapDefinitionsService $map_definition_service,
54
+		PlaceMapperService $place_mapper_service
55
+	) {
56
+		$this->module = $module_service->findByInterface(GeoDispersionModule::class)->first();
57
+		$this->mapadapter_data_service = $mapadapter_data_service;
58
+		$this->map_definition_service = $map_definition_service;
59
+		$this->place_mapper_service = $place_mapper_service;
60
+	}
61 61
 
62
-    /**
63
-     * {@inheritDoc}
64
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
65
-     */
66
-    public function handle(ServerRequestInterface $request): ResponseInterface
67
-    {
68
-        $this->layout = 'layouts/administration';
62
+	/**
63
+	 * {@inheritDoc}
64
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
65
+	 */
66
+	public function handle(ServerRequestInterface $request): ResponseInterface
67
+	{
68
+		$this->layout = 'layouts/administration';
69 69
 
70
-        if ($this->module === null) {
71
-            throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
72
-        }
73
-        $tree = $request->getAttribute('tree');
74
-        assert($tree instanceof Tree);
70
+		if ($this->module === null) {
71
+			throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
72
+		}
73
+		$tree = $request->getAttribute('tree');
74
+		assert($tree instanceof Tree);
75 75
 
76
-        $adapter_id = (int) $request->getAttribute('adapter_id');
77
-        $map_adapter = $this->mapadapter_data_service->find($adapter_id);
76
+		$adapter_id = (int) $request->getAttribute('adapter_id');
77
+		$map_adapter = $this->mapadapter_data_service->find($adapter_id);
78 78
 
79
-        if ($map_adapter === null) {
80
-            throw new HttpNotFoundException(
81
-                I18N::translate('The map configuration could not be found.')
82
-            );
83
-        }
79
+		if ($map_adapter === null) {
80
+			throw new HttpNotFoundException(
81
+				I18N::translate('The map configuration could not be found.')
82
+			);
83
+		}
84 84
 
85
-        return $this->viewResponse($this->module->name() . '::admin/map-adapter-edit', [
86
-            'module'            =>  $this->module,
87
-            'title'             =>  I18N::translate('Edit the map configuration'),
88
-            'tree'              =>  $tree,
89
-            'view_id'           =>  $map_adapter->geoAnalysisViewId(),
90
-            'map_adapter'       =>  $map_adapter,
91
-            'maps_list'         =>  $this->map_definition_service->all(),
92
-            'mappers_list'      =>  $this->place_mapper_service->all(),
93
-            'route_edit'        =>  route(MapAdapterEditAction::class, [
94
-                                        'tree' => $tree->name(),
95
-                                        'adapter_id' => $map_adapter->id()
96
-                                    ])
97
-        ]);
98
-    }
85
+		return $this->viewResponse($this->module->name() . '::admin/map-adapter-edit', [
86
+			'module'            =>  $this->module,
87
+			'title'             =>  I18N::translate('Edit the map configuration'),
88
+			'tree'              =>  $tree,
89
+			'view_id'           =>  $map_adapter->geoAnalysisViewId(),
90
+			'map_adapter'       =>  $map_adapter,
91
+			'maps_list'         =>  $this->map_definition_service->all(),
92
+			'mappers_list'      =>  $this->place_mapper_service->all(),
93
+			'route_edit'        =>  route(MapAdapterEditAction::class, [
94
+										'tree' => $tree->name(),
95
+										'adapter_id' => $map_adapter->id()
96
+									])
97
+		]);
98
+	}
99 99
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         $tree = $request->getAttribute('tree');
74 74
         assert($tree instanceof Tree);
75 75
 
76
-        $adapter_id = (int) $request->getAttribute('adapter_id');
76
+        $adapter_id = (int)$request->getAttribute('adapter_id');
77 77
         $map_adapter = $this->mapadapter_data_service->find($adapter_id);
78 78
 
79 79
         if ($map_adapter === null) {
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             );
83 83
         }
84 84
 
85
-        return $this->viewResponse($this->module->name() . '::admin/map-adapter-edit', [
85
+        return $this->viewResponse($this->module->name().'::admin/map-adapter-edit', [
86 86
             'module'            =>  $this->module,
87 87
             'title'             =>  I18N::translate('Edit the map configuration'),
88 88
             'tree'              =>  $tree,
Please login to merge, or discard this patch.