Passed
Push — main ( 00c5b4...fe37d7 )
by Jonathan
03:49
created
app/Module/WelcomeBlock/WelcomeBlockModule.php 1 patch
Indentation   +159 added lines, -159 removed lines patch added patch discarded remove patch
@@ -34,163 +34,163 @@
 block discarded – undo
34 34
  */
35 35
 class WelcomeBlockModule extends AbstractModule implements ModuleMyArtJaubInterface, ModuleBlockInterface
36 36
 {
37
-    use ModuleMyArtJaubTrait;
38
-    use ModuleBlockTrait;
39
-
40
-    /**
41
-     * {@inheritDoc}
42
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::title()
43
-     */
44
-    public function title(): string
45
-    {
46
-        return /* I18N: Name of the “WelcomeBlock” module */ I18N::translate('MyArtJaub Welcome Block');
47
-    }
48
-
49
-    /**
50
-     * {@inheritDoc}
51
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::description()
52
-     */
53
-    public function description(): string
54
-    {
55
-        //phpcs:ignore Generic.Files.LineLength.TooLong
56
-        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.');
57
-    }
58
-
59
-    /**
60
-     * {@inheritDoc}
61
-     * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes()
62
-     */
63
-    public function loadRoutes(Map $router): void
64
-    {
65
-        $router->attach('', '', static function (Map $router): void {
66
-
67
-            $router->attach('', '/module-maj/welcomeblock/{block_id}', static function (Map $router): void {
68
-                $router->tokens(['block_id' => '\d+']);
69
-                $router->get(MatomoStats::class, '/matomostats', MatomoStats::class);
70
-            });
71
-        });
72
-    }
73
-
74
-    /**
75
-     * {@inheritDoc}
76
-     * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion()
77
-     */
78
-    public function customModuleVersion(): string
79
-    {
80
-        return '2.1.3-v.1';
81
-    }
82
-
83
-    /**
84
-     * {@inheritDoc}
85
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::getBlock()
86
-     *
87
-     * @param mixed[] $config
88
-     */
89
-    public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string
90
-    {
91
-        $fab_welcome_block_view = app(\Fisharebest\Webtrees\Module\WelcomeBlockModule::class)
92
-            ->getBlock($tree, $block_id, ModuleBlockInterface::CONTEXT_EMBED);
93
-
94
-        $fab_login_block_view = app(\Fisharebest\Webtrees\Module\LoginBlockModule::class)
95
-            ->getBlock($tree, $block_id, ModuleBlockInterface::CONTEXT_EMBED);
96
-
97
-        $content = view($this->name() . '::block-embed', [
98
-            'block_id'                  =>  $block_id,
99
-            'fab_welcome_block_view'    =>  $fab_welcome_block_view,
100
-            'fab_login_block_view'      =>  $fab_login_block_view,
101
-            'matomo_enabled'            =>  $this->isMatomoEnabled($block_id),
102
-            'js_script_url'             =>  $this->assetUrl('js/welcomeblock.min.js')
103
-        ]);
104
-
105
-        if ($context !== self::CONTEXT_EMBED) {
106
-            return view('modules/block-template', [
107
-                'block'      => Str::kebab($this->name()),
108
-                'id'         => $block_id,
109
-                'config_url' => $this->configUrl($tree, $context, $block_id),
110
-                'title'      => e($tree->title()),
111
-                'content'    => $content,
112
-            ]);
113
-        }
114
-
115
-        return $content;
116
-    }
117
-
118
-    /**
119
-     * {@inheritDoc}
120
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isTreeBlock()
121
-     */
122
-    public function isTreeBlock(): bool
123
-    {
124
-        return true;
125
-    }
126
-
127
-    /**
128
-     * {@inheritDoc}
129
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::editBlockConfiguration()
130
-     */
131
-    public function editBlockConfiguration(Tree $tree, int $block_id): string
132
-    {
133
-        return view($this->name() . '::config', $this->matomoSettings($block_id));
134
-    }
135
-
136
-    /**
137
-     * {@inheritDoc}
138
-     * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::saveBlockConfiguration()
139
-     */
140
-    public function saveBlockConfiguration(ServerRequestInterface $request, int $block_id): void
141
-    {
142
-        $matomo_enabled = Validator::parsedBody($request)->string('matomo_enabled', '') === 'yes';
143
-        $this->setBlockSetting($block_id, 'matomo_enabled', $matomo_enabled ? 'yes' : 'no');
144
-        if (!$matomo_enabled) {
145
-            return;
146
-        }
147
-
148
-        $matomo_url = trim(Validator::parsedBody($request)->string('matomo_url', ''));
149
-        if (filter_var($matomo_url, FILTER_VALIDATE_URL) === false) {
150
-            FlashMessages::addMessage(I18N::translate('The Matomo URL provided is not valid.'), 'danger');
151
-            return;
152
-        }
153
-
154
-        $matomo_siteid = Validator::parsedBody($request)->integer('matomo_siteid', -1);
155
-        if ($matomo_siteid === -1) {
156
-            FlashMessages::addMessage(I18N::translate('The Matomo Site ID provided is not valid.'), 'danger');
157
-            return;
158
-        }
159
-
160
-        $matomo_token = trim(Validator::parsedBody($request)->string('matomo_token', ''));
161
-
162
-        $this
163
-            ->setBlockSetting($block_id, 'matomo_url', $matomo_url)
164
-            ->setBlockSetting($block_id, 'matomo_token', $matomo_token)
165
-            ->setBlockSetting($block_id, 'matomo_siteid', (string) $matomo_siteid);
166
-
167
-        Registry::cache()->file()->forget($this->name() . '-matomovisits-yearly-' . $block_id);
168
-    }
169
-
170
-    /**
171
-     * Returns whether Matomo statistics is enabled for a specific MyArtJaub WelcomeBlock block
172
-     *
173
-     * @param int $block_id
174
-     * @return bool
175
-     */
176
-    public function isMatomoEnabled(int $block_id): bool
177
-    {
178
-        return $this->getBlockSetting($block_id, 'matomo_enabled', 'no') === 'yes';
179
-    }
180
-
181
-    /**
182
-     * Returns settings for retrieving Matomo statistics for a specific MyArtJaub WelcomeBlock block
183
-     *
184
-     * @param int $block_id
185
-     * @return array<string, mixed>
186
-     */
187
-    public function matomoSettings(int $block_id): array
188
-    {
189
-        return [
190
-            'matomo_enabled' => $this->isMatomoEnabled($block_id),
191
-            'matomo_url' => $this->getBlockSetting($block_id, 'matomo_url'),
192
-            'matomo_token' => $this->getBlockSetting($block_id, 'matomo_token'),
193
-            'matomo_siteid'  => (int) $this->getBlockSetting($block_id, 'matomo_siteid', '0')
194
-        ];
195
-    }
37
+	use ModuleMyArtJaubTrait;
38
+	use ModuleBlockTrait;
39
+
40
+	/**
41
+	 * {@inheritDoc}
42
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::title()
43
+	 */
44
+	public function title(): string
45
+	{
46
+		return /* I18N: Name of the “WelcomeBlock” module */ I18N::translate('MyArtJaub Welcome Block');
47
+	}
48
+
49
+	/**
50
+	 * {@inheritDoc}
51
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::description()
52
+	 */
53
+	public function description(): string
54
+	{
55
+		//phpcs:ignore Generic.Files.LineLength.TooLong
56
+		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.');
57
+	}
58
+
59
+	/**
60
+	 * {@inheritDoc}
61
+	 * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes()
62
+	 */
63
+	public function loadRoutes(Map $router): void
64
+	{
65
+		$router->attach('', '', static function (Map $router): void {
66
+
67
+			$router->attach('', '/module-maj/welcomeblock/{block_id}', static function (Map $router): void {
68
+				$router->tokens(['block_id' => '\d+']);
69
+				$router->get(MatomoStats::class, '/matomostats', MatomoStats::class);
70
+			});
71
+		});
72
+	}
73
+
74
+	/**
75
+	 * {@inheritDoc}
76
+	 * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion()
77
+	 */
78
+	public function customModuleVersion(): string
79
+	{
80
+		return '2.1.3-v.1';
81
+	}
82
+
83
+	/**
84
+	 * {@inheritDoc}
85
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::getBlock()
86
+	 *
87
+	 * @param mixed[] $config
88
+	 */
89
+	public function getBlock(Tree $tree, int $block_id, string $context, array $config = []): string
90
+	{
91
+		$fab_welcome_block_view = app(\Fisharebest\Webtrees\Module\WelcomeBlockModule::class)
92
+			->getBlock($tree, $block_id, ModuleBlockInterface::CONTEXT_EMBED);
93
+
94
+		$fab_login_block_view = app(\Fisharebest\Webtrees\Module\LoginBlockModule::class)
95
+			->getBlock($tree, $block_id, ModuleBlockInterface::CONTEXT_EMBED);
96
+
97
+		$content = view($this->name() . '::block-embed', [
98
+			'block_id'                  =>  $block_id,
99
+			'fab_welcome_block_view'    =>  $fab_welcome_block_view,
100
+			'fab_login_block_view'      =>  $fab_login_block_view,
101
+			'matomo_enabled'            =>  $this->isMatomoEnabled($block_id),
102
+			'js_script_url'             =>  $this->assetUrl('js/welcomeblock.min.js')
103
+		]);
104
+
105
+		if ($context !== self::CONTEXT_EMBED) {
106
+			return view('modules/block-template', [
107
+				'block'      => Str::kebab($this->name()),
108
+				'id'         => $block_id,
109
+				'config_url' => $this->configUrl($tree, $context, $block_id),
110
+				'title'      => e($tree->title()),
111
+				'content'    => $content,
112
+			]);
113
+		}
114
+
115
+		return $content;
116
+	}
117
+
118
+	/**
119
+	 * {@inheritDoc}
120
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isTreeBlock()
121
+	 */
122
+	public function isTreeBlock(): bool
123
+	{
124
+		return true;
125
+	}
126
+
127
+	/**
128
+	 * {@inheritDoc}
129
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::editBlockConfiguration()
130
+	 */
131
+	public function editBlockConfiguration(Tree $tree, int $block_id): string
132
+	{
133
+		return view($this->name() . '::config', $this->matomoSettings($block_id));
134
+	}
135
+
136
+	/**
137
+	 * {@inheritDoc}
138
+	 * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::saveBlockConfiguration()
139
+	 */
140
+	public function saveBlockConfiguration(ServerRequestInterface $request, int $block_id): void
141
+	{
142
+		$matomo_enabled = Validator::parsedBody($request)->string('matomo_enabled', '') === 'yes';
143
+		$this->setBlockSetting($block_id, 'matomo_enabled', $matomo_enabled ? 'yes' : 'no');
144
+		if (!$matomo_enabled) {
145
+			return;
146
+		}
147
+
148
+		$matomo_url = trim(Validator::parsedBody($request)->string('matomo_url', ''));
149
+		if (filter_var($matomo_url, FILTER_VALIDATE_URL) === false) {
150
+			FlashMessages::addMessage(I18N::translate('The Matomo URL provided is not valid.'), 'danger');
151
+			return;
152
+		}
153
+
154
+		$matomo_siteid = Validator::parsedBody($request)->integer('matomo_siteid', -1);
155
+		if ($matomo_siteid === -1) {
156
+			FlashMessages::addMessage(I18N::translate('The Matomo Site ID provided is not valid.'), 'danger');
157
+			return;
158
+		}
159
+
160
+		$matomo_token = trim(Validator::parsedBody($request)->string('matomo_token', ''));
161
+
162
+		$this
163
+			->setBlockSetting($block_id, 'matomo_url', $matomo_url)
164
+			->setBlockSetting($block_id, 'matomo_token', $matomo_token)
165
+			->setBlockSetting($block_id, 'matomo_siteid', (string) $matomo_siteid);
166
+
167
+		Registry::cache()->file()->forget($this->name() . '-matomovisits-yearly-' . $block_id);
168
+	}
169
+
170
+	/**
171
+	 * Returns whether Matomo statistics is enabled for a specific MyArtJaub WelcomeBlock block
172
+	 *
173
+	 * @param int $block_id
174
+	 * @return bool
175
+	 */
176
+	public function isMatomoEnabled(int $block_id): bool
177
+	{
178
+		return $this->getBlockSetting($block_id, 'matomo_enabled', 'no') === 'yes';
179
+	}
180
+
181
+	/**
182
+	 * Returns settings for retrieving Matomo statistics for a specific MyArtJaub WelcomeBlock block
183
+	 *
184
+	 * @param int $block_id
185
+	 * @return array<string, mixed>
186
+	 */
187
+	public function matomoSettings(int $block_id): array
188
+	{
189
+		return [
190
+			'matomo_enabled' => $this->isMatomoEnabled($block_id),
191
+			'matomo_url' => $this->getBlockSetting($block_id, 'matomo_url'),
192
+			'matomo_token' => $this->getBlockSetting($block_id, 'matomo_token'),
193
+			'matomo_siteid'  => (int) $this->getBlockSetting($block_id, 'matomo_siteid', '0')
194
+		];
195
+	}
196 196
 }
Please login to merge, or discard this patch.
app/Module/AdminTasks/AdminTasksModule.php 1 patch
Indentation   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -41,127 +41,127 @@
 block discarded – undo
41 41
  * Allow for tasks to be run on a (nearly-)regular schedule
42 42
  */
43 43
 class AdminTasksModule extends AbstractModule implements
44
-    ModuleMyArtJaubInterface,
45
-    ModuleConfigInterface,
46
-    ModuleGlobalInterface,
47
-    ModuleTasksProviderInterface
44
+	ModuleMyArtJaubInterface,
45
+	ModuleConfigInterface,
46
+	ModuleGlobalInterface,
47
+	ModuleTasksProviderInterface
48 48
 {
49
-    use ModuleMyArtJaubTrait {
50
-        boot as traitBoot;
51
-    }
52
-    use ModuleConfigTrait;
53
-    use ModuleGlobalTrait;
54
-
55
-    //How to update the database schema for this module
56
-    private const SCHEMA_TARGET_VERSION   = 2;
57
-    private const SCHEMA_SETTING_NAME     = 'MAJ_ADMTASKS_SCHEMA_VERSION';
58
-    private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema';
59
-
60
-    /**
61
-     * {@inheritDoc}
62
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::title()
63
-     */
64
-    public function title(): string
65
-    {
66
-        return I18N::translate('Administration Tasks');
67
-    }
68
-
69
-    /**
70
-     * {@inheritDoc}
71
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::description()
72
-     */
73
-    public function description(): string
74
-    {
75
-        return I18N::translate('Manage and run nearly-scheduled administration tasks.');
76
-    }
77
-
78
-    /**
79
-     * {@inheritDoc}
80
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::boot()
81
-     */
82
-    public function boot(): void
83
-    {
84
-        $this->traitBoot();
85
-        app(MigrationService::class)->updateSchema(
86
-            self::SCHEMA_MIGRATION_PREFIX,
87
-            self::SCHEMA_SETTING_NAME,
88
-            self::SCHEMA_TARGET_VERSION
89
-        );
90
-    }
91
-
92
-    /**
93
-     * {@inheritDoc}
94
-     * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes()
95
-     */
96
-    public function loadRoutes(Map $router): void
97
-    {
98
-        $router->attach('', '', static function (Map $router): void {
99
-
100
-            $router->attach('', '/module-maj/admintasks', static function (Map $router): void {
101
-                $router->tokens(['enable' => '[01]']);
102
-
103
-                $router->attach('', '/admin', static function (Map $router): void {
104
-
105
-                    $router->extras([
106
-                        'middleware' => [
107
-                            AuthAdministrator::class,
108
-                        ],
109
-                    ]);
110
-                    $router->get(AdminConfigPage::class, '/config', AdminConfigPage::class);
111
-
112
-                    $router->attach('', '/tasks', static function (Map $router): void {
113
-
114
-                        $router->get(TasksList::class, '', TasksList::class);
115
-                        $router->get(TaskEditPage::class, '/{task}', TaskEditPage::class);
116
-                        $router->post(TaskEditAction::class, '/{task}', TaskEditAction::class);
117
-                        $router->get(TaskStatusAction::class, '/{task}/status/{enable}', TaskStatusAction::class);
118
-                    });
119
-                });
120
-
121
-                $router->get(TaskTrigger::class, '/trigger{/task}', TaskTrigger::class)
122
-                    ->allows(RequestMethodInterface::METHOD_POST);
123
-
124
-                $router->post(TokenGenerate::class, '/token', TokenGenerate::class)
125
-                    ->extras(['middleware' => [AuthAdministrator::class]]);
126
-            });
127
-        });
128
-    }
129
-
130
-    /**
131
-     * {@inheritDoc}
132
-     * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleLatestVersion()
133
-     */
134
-    public function customModuleVersion(): string
135
-    {
136
-        return '2.1.3-v.1';
137
-    }
138
-
139
-    /**
140
-     * {@inheritDoc}
141
-     * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink()
142
-     */
143
-    public function getConfigLink(): string
144
-    {
145
-        return route(AdminConfigPage::class);
146
-    }
147
-
148
-    /**
149
-     * {@inheritDoc}
150
-     * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::bodyContent()
151
-     */
152
-    public function bodyContent(): string
153
-    {
154
-        return view($this->name() . '::snippet', [ 'url' => route(TaskTrigger::class) ]);
155
-    }
156
-
157
-    /**
158
-     * {@inheritDoc}
159
-     * @see ModuleTasksProviderInterface::listTasks()
160
-     */
161
-    public function listTasks(): array
162
-    {
163
-        return [
164
-            'maj-healthcheck' => HealthCheckEmailTask::class
165
-        ];
166
-    }
49
+	use ModuleMyArtJaubTrait {
50
+		boot as traitBoot;
51
+	}
52
+	use ModuleConfigTrait;
53
+	use ModuleGlobalTrait;
54
+
55
+	//How to update the database schema for this module
56
+	private const SCHEMA_TARGET_VERSION   = 2;
57
+	private const SCHEMA_SETTING_NAME     = 'MAJ_ADMTASKS_SCHEMA_VERSION';
58
+	private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema';
59
+
60
+	/**
61
+	 * {@inheritDoc}
62
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::title()
63
+	 */
64
+	public function title(): string
65
+	{
66
+		return I18N::translate('Administration Tasks');
67
+	}
68
+
69
+	/**
70
+	 * {@inheritDoc}
71
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::description()
72
+	 */
73
+	public function description(): string
74
+	{
75
+		return I18N::translate('Manage and run nearly-scheduled administration tasks.');
76
+	}
77
+
78
+	/**
79
+	 * {@inheritDoc}
80
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::boot()
81
+	 */
82
+	public function boot(): void
83
+	{
84
+		$this->traitBoot();
85
+		app(MigrationService::class)->updateSchema(
86
+			self::SCHEMA_MIGRATION_PREFIX,
87
+			self::SCHEMA_SETTING_NAME,
88
+			self::SCHEMA_TARGET_VERSION
89
+		);
90
+	}
91
+
92
+	/**
93
+	 * {@inheritDoc}
94
+	 * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes()
95
+	 */
96
+	public function loadRoutes(Map $router): void
97
+	{
98
+		$router->attach('', '', static function (Map $router): void {
99
+
100
+			$router->attach('', '/module-maj/admintasks', static function (Map $router): void {
101
+				$router->tokens(['enable' => '[01]']);
102
+
103
+				$router->attach('', '/admin', static function (Map $router): void {
104
+
105
+					$router->extras([
106
+						'middleware' => [
107
+							AuthAdministrator::class,
108
+						],
109
+					]);
110
+					$router->get(AdminConfigPage::class, '/config', AdminConfigPage::class);
111
+
112
+					$router->attach('', '/tasks', static function (Map $router): void {
113
+
114
+						$router->get(TasksList::class, '', TasksList::class);
115
+						$router->get(TaskEditPage::class, '/{task}', TaskEditPage::class);
116
+						$router->post(TaskEditAction::class, '/{task}', TaskEditAction::class);
117
+						$router->get(TaskStatusAction::class, '/{task}/status/{enable}', TaskStatusAction::class);
118
+					});
119
+				});
120
+
121
+				$router->get(TaskTrigger::class, '/trigger{/task}', TaskTrigger::class)
122
+					->allows(RequestMethodInterface::METHOD_POST);
123
+
124
+				$router->post(TokenGenerate::class, '/token', TokenGenerate::class)
125
+					->extras(['middleware' => [AuthAdministrator::class]]);
126
+			});
127
+		});
128
+	}
129
+
130
+	/**
131
+	 * {@inheritDoc}
132
+	 * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleLatestVersion()
133
+	 */
134
+	public function customModuleVersion(): string
135
+	{
136
+		return '2.1.3-v.1';
137
+	}
138
+
139
+	/**
140
+	 * {@inheritDoc}
141
+	 * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink()
142
+	 */
143
+	public function getConfigLink(): string
144
+	{
145
+		return route(AdminConfigPage::class);
146
+	}
147
+
148
+	/**
149
+	 * {@inheritDoc}
150
+	 * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::bodyContent()
151
+	 */
152
+	public function bodyContent(): string
153
+	{
154
+		return view($this->name() . '::snippet', [ 'url' => route(TaskTrigger::class) ]);
155
+	}
156
+
157
+	/**
158
+	 * {@inheritDoc}
159
+	 * @see ModuleTasksProviderInterface::listTasks()
160
+	 */
161
+	public function listTasks(): array
162
+	{
163
+		return [
164
+			'maj-healthcheck' => HealthCheckEmailTask::class
165
+		];
166
+	}
167 167
 }
Please login to merge, or discard this patch.
app/Module/GeoDispersion/GeoDispersionModule.php 1 patch
Indentation   +183 added lines, -183 removed lines patch added patch discarded remove patch
@@ -59,188 +59,188 @@
 block discarded – undo
59 59
  * Geographical Dispersion Module.
60 60
  */
61 61
 class GeoDispersionModule extends AbstractModule implements
62
-    ModuleMyArtJaubInterface,
63
-    ModuleChartInterface,
64
-    ModuleConfigInterface,
65
-    ModuleGlobalInterface,
66
-    ModuleGeoAnalysisProviderInterface,
67
-    ModulePlaceMapperProviderInterface
62
+	ModuleMyArtJaubInterface,
63
+	ModuleChartInterface,
64
+	ModuleConfigInterface,
65
+	ModuleGlobalInterface,
66
+	ModuleGeoAnalysisProviderInterface,
67
+	ModulePlaceMapperProviderInterface
68 68
 {
69
-    use ModuleMyArtJaubTrait {
70
-        boot as traitBoot;
71
-    }
72
-    use ModuleChartTrait;
73
-    use ModuleConfigTrait;
74
-    use ModuleGlobalTrait;
75
-
76
-    // How to update the database schema for this module
77
-    private const SCHEMA_TARGET_VERSION   = 3;
78
-    private const SCHEMA_SETTING_NAME     = 'MAJ_GEODISP_SCHEMA_VERSION';
79
-    private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema';
80
-
81
-    /**
82
-     * {@inheritDoc}
83
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::title()
84
-     */
85
-    public function title(): string
86
-    {
87
-        return /* I18N: Name of the “GeoDispersion” module */ I18N::translate('Geographical dispersion');
88
-    }
89
-
90
-    /**
91
-     * {@inheritDoc}
92
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::description()
93
-     */
94
-    public function description(): string
95
-    {
96
-        //phpcs:ignore Generic.Files.LineLength.TooLong
97
-        return /* I18N: Description of the “GeoDispersion” module */ I18N::translate('Perform and display geographical dispersion analyses.');
98
-    }
99
-
100
-    /**
101
-     * {@inheritDoc}
102
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::boot()
103
-     */
104
-    public function boot(): void
105
-    {
106
-        $this->traitBoot();
107
-        app(MigrationService::class)->updateSchema(
108
-            self::SCHEMA_MIGRATION_PREFIX,
109
-            self::SCHEMA_SETTING_NAME,
110
-            self::SCHEMA_TARGET_VERSION
111
-        );
112
-    }
113
-
114
-    /**
115
-     * {@inheritDoc}
116
-     * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion()
117
-     */
118
-    public function customModuleVersion(): string
119
-    {
120
-        return '2.1.3-v.1';
121
-    }
122
-
123
-    /**
124
-     * {@inheritDoc}
125
-     * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes()
126
-     */
127
-    public function loadRoutes(Map $router): void
128
-    {
129
-        $router->attach('', '', static function (Map $router): void {
130
-
131
-            $router->attach('', '/module-maj/geodispersion', static function (Map $router): void {
132
-                $router->attach('', '/admin', static function (Map $router): void {
133
-                    $router->get(AdminConfigPage::class, '/config{/tree}', AdminConfigPage::class);
134
-
135
-                    $router->attach('', '/analysis-views/{tree}', static function (Map $router): void {
136
-                        $router->tokens(['view_id' => '\d+', 'enable' => '[01]']);
137
-                        $router->extras([
138
-                            'middleware' => [
139
-                                AuthManager::class,
140
-                            ],
141
-                        ]);
142
-                        $router->get(GeoAnalysisViewListData::class, '', GeoAnalysisViewListData::class);
143
-
144
-                        $router->get(GeoAnalysisViewAddPage::class, '/add', GeoAnalysisViewAddPage::class);
145
-                        $router->post(GeoAnalysisViewAddAction::class, '/add', GeoAnalysisViewAddAction::class);
146
-                        $router->get(GeoAnalysisViewEditPage::class, '/{view_id}', GeoAnalysisViewEditPage::class);
147
-                        $router->post(GeoAnalysisViewEditAction::class, '/{view_id}', GeoAnalysisViewEditAction::class);
148
-                        //phpcs:disable Generic.Files.LineLength.TooLong
149
-                        $router->get(GeoAnalysisViewStatusAction::class, '/{view_id}/status/{enable}', GeoAnalysisViewStatusAction::class);
150
-                        $router->get(GeoAnalysisViewDeleteAction::class, '/{view_id}/delete', GeoAnalysisViewDeleteAction::class);
151
-                        //phpcs:enable
152
-                    });
153
-
154
-                    $router->attach('', '/map-adapters/{tree}', static function (Map $router): void {
155
-                        $router->tokens(['adapter_id' => '\d+', 'view_id' => '\d+']);
156
-                        $router->extras([
157
-                            'middleware' => [
158
-                                AuthManager::class,
159
-                            ],
160
-                        ]);
161
-
162
-                        $router->get(MapAdapterAddPage::class, '/add/{view_id}', MapAdapterAddPage::class);
163
-                        $router->post(MapAdapterAddAction::class, '/add/{view_id}', MapAdapterAddAction::class);
164
-                        $router->get(MapAdapterEditPage::class, '/{adapter_id}', MapAdapterEditPage::class);
165
-                        $router->post(MapAdapterEditAction::class, '/{adapter_id}', MapAdapterEditAction::class);
166
-                        //phpcs:disable Generic.Files.LineLength.TooLong
167
-                        $router->get(MapAdapterDeleteAction::class, '/{adapter_id}/delete', MapAdapterDeleteAction::class);
168
-                        $router->get(MapAdapterDeleteInvalidAction::class, '/delete-invalid/{view_id}', MapAdapterDeleteInvalidAction::class);
169
-                        $router->get(MapAdapterMapperConfig::class, '/mapper/config{/adapter_id}', MapAdapterMapperConfig::class);
170
-                        //phpcs:enable
171
-                    });
172
-
173
-                    //phpcs:ignore Generic.Files.LineLength.TooLong
174
-                    $router->get(MapFeaturePropertyData::class, '/map/feature-properties{/map_id}', MapFeaturePropertyData::class);
175
-                });
176
-
177
-                $router->get(GeoAnalysisViewsList::class, '/list/{tree}', GeoAnalysisViewsList::class);
178
-
179
-                $router->attach('', '/analysisview/{tree}/{view_id}', static function (Map $router): void {
180
-                    $router->tokens(['view_id' => '\d+']);
181
-                    $router->get(GeoAnalysisViewPage::class, '', GeoAnalysisViewPage::class);
182
-                    $router->get(GeoAnalysisViewTabs::class, '/tabs', GeoAnalysisViewTabs::class);
183
-                });
184
-            });
185
-        });
186
-    }
187
-
188
-    public function getConfigLink(): string
189
-    {
190
-        return route(AdminConfigPage::class);
191
-    }
192
-
193
-    /**
194
-     * {@inheritDoc}
195
-     * @see \Fisharebest\Webtrees\Module\ModuleChartInterface::chartUrl()
196
-     *
197
-     * @param array<bool|int|string|array<mixed>|null> $parameters
198
-     */
199
-    public function chartUrl(Individual $individual, array $parameters = []): string
200
-    {
201
-        return route(GeoAnalysisViewsList::class, ['tree' => $individual->tree()->name()] + $parameters);
202
-    }
203
-
204
-    /**
205
-     * {@inheritDoc}
206
-     * @see \Fisharebest\Webtrees\Module\ModuleChartInterface::chartMenuClass()
207
-     */
208
-    public function chartMenuClass(): string
209
-    {
210
-        return 'menu-maj-geodispersion';
211
-    }
212
-
213
-    /**
214
-     * {@inheritDoc}
215
-     * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::headContent()
216
-     */
217
-    public function headContent(): string
218
-    {
219
-        return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">';
220
-    }
221
-
222
-    /**
223
-     * {@inheritDoc}
224
-     * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\ModulePlaceMapperProviderInterface::listPlaceMappers()
225
-     */
226
-    public function listPlaceMappers(): array
227
-    {
228
-        return [
229
-            CoordinatesPlaceMapper::class,
230
-            SimplePlaceMapper::class,
231
-            SimpleTopFilteredPlaceMapper::class
232
-        ];
233
-    }
234
-
235
-    /**
236
-     * {@inheritDoc}
237
-     * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\ModuleGeoAnalysisProviderInterface::listGeoAnalyses()
238
-     */
239
-    public function listGeoAnalyses(): array
240
-    {
241
-        return [
242
-            AllEventsByCenturyGeoAnalysis::class,
243
-            AllEventsByTypeGeoAnalysis::class
244
-        ];
245
-    }
69
+	use ModuleMyArtJaubTrait {
70
+		boot as traitBoot;
71
+	}
72
+	use ModuleChartTrait;
73
+	use ModuleConfigTrait;
74
+	use ModuleGlobalTrait;
75
+
76
+	// How to update the database schema for this module
77
+	private const SCHEMA_TARGET_VERSION   = 3;
78
+	private const SCHEMA_SETTING_NAME     = 'MAJ_GEODISP_SCHEMA_VERSION';
79
+	private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema';
80
+
81
+	/**
82
+	 * {@inheritDoc}
83
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::title()
84
+	 */
85
+	public function title(): string
86
+	{
87
+		return /* I18N: Name of the “GeoDispersion” module */ I18N::translate('Geographical dispersion');
88
+	}
89
+
90
+	/**
91
+	 * {@inheritDoc}
92
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::description()
93
+	 */
94
+	public function description(): string
95
+	{
96
+		//phpcs:ignore Generic.Files.LineLength.TooLong
97
+		return /* I18N: Description of the “GeoDispersion” module */ I18N::translate('Perform and display geographical dispersion analyses.');
98
+	}
99
+
100
+	/**
101
+	 * {@inheritDoc}
102
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::boot()
103
+	 */
104
+	public function boot(): void
105
+	{
106
+		$this->traitBoot();
107
+		app(MigrationService::class)->updateSchema(
108
+			self::SCHEMA_MIGRATION_PREFIX,
109
+			self::SCHEMA_SETTING_NAME,
110
+			self::SCHEMA_TARGET_VERSION
111
+		);
112
+	}
113
+
114
+	/**
115
+	 * {@inheritDoc}
116
+	 * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion()
117
+	 */
118
+	public function customModuleVersion(): string
119
+	{
120
+		return '2.1.3-v.1';
121
+	}
122
+
123
+	/**
124
+	 * {@inheritDoc}
125
+	 * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes()
126
+	 */
127
+	public function loadRoutes(Map $router): void
128
+	{
129
+		$router->attach('', '', static function (Map $router): void {
130
+
131
+			$router->attach('', '/module-maj/geodispersion', static function (Map $router): void {
132
+				$router->attach('', '/admin', static function (Map $router): void {
133
+					$router->get(AdminConfigPage::class, '/config{/tree}', AdminConfigPage::class);
134
+
135
+					$router->attach('', '/analysis-views/{tree}', static function (Map $router): void {
136
+						$router->tokens(['view_id' => '\d+', 'enable' => '[01]']);
137
+						$router->extras([
138
+							'middleware' => [
139
+								AuthManager::class,
140
+							],
141
+						]);
142
+						$router->get(GeoAnalysisViewListData::class, '', GeoAnalysisViewListData::class);
143
+
144
+						$router->get(GeoAnalysisViewAddPage::class, '/add', GeoAnalysisViewAddPage::class);
145
+						$router->post(GeoAnalysisViewAddAction::class, '/add', GeoAnalysisViewAddAction::class);
146
+						$router->get(GeoAnalysisViewEditPage::class, '/{view_id}', GeoAnalysisViewEditPage::class);
147
+						$router->post(GeoAnalysisViewEditAction::class, '/{view_id}', GeoAnalysisViewEditAction::class);
148
+						//phpcs:disable Generic.Files.LineLength.TooLong
149
+						$router->get(GeoAnalysisViewStatusAction::class, '/{view_id}/status/{enable}', GeoAnalysisViewStatusAction::class);
150
+						$router->get(GeoAnalysisViewDeleteAction::class, '/{view_id}/delete', GeoAnalysisViewDeleteAction::class);
151
+						//phpcs:enable
152
+					});
153
+
154
+					$router->attach('', '/map-adapters/{tree}', static function (Map $router): void {
155
+						$router->tokens(['adapter_id' => '\d+', 'view_id' => '\d+']);
156
+						$router->extras([
157
+							'middleware' => [
158
+								AuthManager::class,
159
+							],
160
+						]);
161
+
162
+						$router->get(MapAdapterAddPage::class, '/add/{view_id}', MapAdapterAddPage::class);
163
+						$router->post(MapAdapterAddAction::class, '/add/{view_id}', MapAdapterAddAction::class);
164
+						$router->get(MapAdapterEditPage::class, '/{adapter_id}', MapAdapterEditPage::class);
165
+						$router->post(MapAdapterEditAction::class, '/{adapter_id}', MapAdapterEditAction::class);
166
+						//phpcs:disable Generic.Files.LineLength.TooLong
167
+						$router->get(MapAdapterDeleteAction::class, '/{adapter_id}/delete', MapAdapterDeleteAction::class);
168
+						$router->get(MapAdapterDeleteInvalidAction::class, '/delete-invalid/{view_id}', MapAdapterDeleteInvalidAction::class);
169
+						$router->get(MapAdapterMapperConfig::class, '/mapper/config{/adapter_id}', MapAdapterMapperConfig::class);
170
+						//phpcs:enable
171
+					});
172
+
173
+					//phpcs:ignore Generic.Files.LineLength.TooLong
174
+					$router->get(MapFeaturePropertyData::class, '/map/feature-properties{/map_id}', MapFeaturePropertyData::class);
175
+				});
176
+
177
+				$router->get(GeoAnalysisViewsList::class, '/list/{tree}', GeoAnalysisViewsList::class);
178
+
179
+				$router->attach('', '/analysisview/{tree}/{view_id}', static function (Map $router): void {
180
+					$router->tokens(['view_id' => '\d+']);
181
+					$router->get(GeoAnalysisViewPage::class, '', GeoAnalysisViewPage::class);
182
+					$router->get(GeoAnalysisViewTabs::class, '/tabs', GeoAnalysisViewTabs::class);
183
+				});
184
+			});
185
+		});
186
+	}
187
+
188
+	public function getConfigLink(): string
189
+	{
190
+		return route(AdminConfigPage::class);
191
+	}
192
+
193
+	/**
194
+	 * {@inheritDoc}
195
+	 * @see \Fisharebest\Webtrees\Module\ModuleChartInterface::chartUrl()
196
+	 *
197
+	 * @param array<bool|int|string|array<mixed>|null> $parameters
198
+	 */
199
+	public function chartUrl(Individual $individual, array $parameters = []): string
200
+	{
201
+		return route(GeoAnalysisViewsList::class, ['tree' => $individual->tree()->name()] + $parameters);
202
+	}
203
+
204
+	/**
205
+	 * {@inheritDoc}
206
+	 * @see \Fisharebest\Webtrees\Module\ModuleChartInterface::chartMenuClass()
207
+	 */
208
+	public function chartMenuClass(): string
209
+	{
210
+		return 'menu-maj-geodispersion';
211
+	}
212
+
213
+	/**
214
+	 * {@inheritDoc}
215
+	 * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::headContent()
216
+	 */
217
+	public function headContent(): string
218
+	{
219
+		return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">';
220
+	}
221
+
222
+	/**
223
+	 * {@inheritDoc}
224
+	 * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\ModulePlaceMapperProviderInterface::listPlaceMappers()
225
+	 */
226
+	public function listPlaceMappers(): array
227
+	{
228
+		return [
229
+			CoordinatesPlaceMapper::class,
230
+			SimplePlaceMapper::class,
231
+			SimpleTopFilteredPlaceMapper::class
232
+		];
233
+	}
234
+
235
+	/**
236
+	 * {@inheritDoc}
237
+	 * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\ModuleGeoAnalysisProviderInterface::listGeoAnalyses()
238
+	 */
239
+	public function listGeoAnalyses(): array
240
+	{
241
+		return [
242
+			AllEventsByCenturyGeoAnalysis::class,
243
+			AllEventsByTypeGeoAnalysis::class
244
+		];
245
+	}
246 246
 }
Please login to merge, or discard this patch.
app/Module/MiscExtensions/MiscExtensionsModule.php 1 patch
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -32,89 +32,89 @@
 block discarded – undo
32 32
  * Provide miscellaneous improvements to webtrees.
33 33
  */
34 34
 class MiscExtensionsModule extends AbstractModule implements
35
-    ModuleMyArtJaubInterface,
36
-    ModuleConfigInterface,
37
-    ModuleHookSubscriberInterface
35
+	ModuleMyArtJaubInterface,
36
+	ModuleConfigInterface,
37
+	ModuleHookSubscriberInterface
38 38
 {
39
-    use ModuleMyArtJaubTrait {
40
-        boot as traitBoot;
41
-    }
42
-    use ModuleConfigTrait;
39
+	use ModuleMyArtJaubTrait {
40
+		boot as traitBoot;
41
+	}
42
+	use ModuleConfigTrait;
43 43
 
44
-    /**
45
-     * {@inheritDoc}
46
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::title()
47
-     */
48
-    public function title(): string
49
-    {
50
-        return /* I18N: Name of the “MiscExtensions” module */ I18N::translate('Miscellaneous extensions');
51
-    }
44
+	/**
45
+	 * {@inheritDoc}
46
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::title()
47
+	 */
48
+	public function title(): string
49
+	{
50
+		return /* I18N: Name of the “MiscExtensions” module */ I18N::translate('Miscellaneous extensions');
51
+	}
52 52
 
53
-    /**
54
-     * {@inheritDoc}
55
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::description()
56
-     */
57
-    public function description(): string
58
-    {
59
-        //phpcs:ignore Generic.Files.LineLength.TooLong
60
-        return /* I18N: Description of the “MiscExtensions” module */ I18N::translate('Miscellaneous extensions for webtrees.');
61
-    }
53
+	/**
54
+	 * {@inheritDoc}
55
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::description()
56
+	 */
57
+	public function description(): string
58
+	{
59
+		//phpcs:ignore Generic.Files.LineLength.TooLong
60
+		return /* I18N: Description of the “MiscExtensions” module */ I18N::translate('Miscellaneous extensions for webtrees.');
61
+	}
62 62
 
63
-    /**
64
-     * {@inheritDoc}
65
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::boot()
66
-     */
67
-    public function boot(): void
68
-    {
69
-        $this->traitBoot();
70
-        View::registerCustomView('::modules/privacy-policy/page', $this->name() . '::privacy-policy');
71
-    }
63
+	/**
64
+	 * {@inheritDoc}
65
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::boot()
66
+	 */
67
+	public function boot(): void
68
+	{
69
+		$this->traitBoot();
70
+		View::registerCustomView('::modules/privacy-policy/page', $this->name() . '::privacy-policy');
71
+	}
72 72
 
73
-    /**
74
-     * {@inheritDoc}
75
-     * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes()
76
-     */
77
-    public function loadRoutes(Map $router): void
78
-    {
79
-        $router->attach('', '', static function (Map $router): void {
73
+	/**
74
+	 * {@inheritDoc}
75
+	 * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes()
76
+	 */
77
+	public function loadRoutes(Map $router): void
78
+	{
79
+		$router->attach('', '', static function (Map $router): void {
80 80
 
81
-            $router->attach('', '/module-maj/misc', static function (Map $router): void {
81
+			$router->attach('', '/module-maj/misc', static function (Map $router): void {
82 82
 
83
-                $router->attach('', '/config/admin', static function (Map $router): void {
83
+				$router->attach('', '/config/admin', static function (Map $router): void {
84 84
 
85
-                    $router->get(AdminConfigPage::class, '', AdminConfigPage::class);
86
-                    $router->post(AdminConfigAction::class, '', AdminConfigAction::class);
87
-                });
88
-            });
89
-        });
90
-    }
85
+					$router->get(AdminConfigPage::class, '', AdminConfigPage::class);
86
+					$router->post(AdminConfigAction::class, '', AdminConfigAction::class);
87
+				});
88
+			});
89
+		});
90
+	}
91 91
 
92
-    /**
93
-     * {@inheritDoc}
94
-     * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion()
95
-     */
96
-    public function customModuleVersion(): string
97
-    {
98
-        return '2.1.3-v.1';
99
-    }
92
+	/**
93
+	 * {@inheritDoc}
94
+	 * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion()
95
+	 */
96
+	public function customModuleVersion(): string
97
+	{
98
+		return '2.1.3-v.1';
99
+	}
100 100
 
101
-    /**
102
-     * {@inheritDoc}
103
-     * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink()
104
-     */
105
-    public function getConfigLink(): string
106
-    {
107
-        return route(AdminConfigPage::class);
108
-    }
101
+	/**
102
+	 * {@inheritDoc}
103
+	 * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink()
104
+	 */
105
+	public function getConfigLink(): string
106
+	{
107
+		return route(AdminConfigPage::class);
108
+	}
109 109
 
110
-    /**
111
-     * {@inheritDoc}
112
-     * @see \MyArtJaub\Webtrees\Contracts\Hooks\ModuleHookSubscriberInterface::listSubscribedHooks()
113
-     */
114
-    public function listSubscribedHooks(): array
115
-    {
116
-        return [
117
-            app()->makeWith(TitlesCardHook::class, [ 'module' => $this ])
118
-        ];
119
-    }
110
+	/**
111
+	 * {@inheritDoc}
112
+	 * @see \MyArtJaub\Webtrees\Contracts\Hooks\ModuleHookSubscriberInterface::listSubscribedHooks()
113
+	 */
114
+	public function listSubscribedHooks(): array
115
+	{
116
+		return [
117
+			app()->makeWith(TitlesCardHook::class, [ 'module' => $this ])
118
+		];
119
+	}
120 120
 }
Please login to merge, or discard this patch.
app/Module/Certificates/Elements/SourceCertificate.php 1 patch
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -28,61 +28,61 @@
 block discarded – undo
28 28
  */
29 29
 class SourceCertificate extends AbstractElement
30 30
 {
31
-    protected CertificatesModule $module;
32
-    protected CertificateFilesystemService $certif_filesystem;
33
-    protected UrlObfuscatorService $url_obfuscator_service;
31
+	protected CertificatesModule $module;
32
+	protected CertificateFilesystemService $certif_filesystem;
33
+	protected UrlObfuscatorService $url_obfuscator_service;
34 34
 
35
-    /**
36
-     * Constructor for SourceCertificate element
37
-     *
38
-     * @param string $label
39
-     * @param CertificatesModule $module
40
-     * @param CertificateFilesystemService $certif_filesystem
41
-     * @param UrlObfuscatorService $url_obfuscator_service
42
-     */
43
-    public function __construct(
44
-        string $label,
45
-        CertificatesModule $module,
46
-        CertificateFilesystemService $certif_filesystem = null,
47
-        UrlObfuscatorService $url_obfuscator_service = null
48
-    ) {
49
-        parent::__construct($label, null);
50
-        $this->module = $module;
51
-        $this->certif_filesystem = $certif_filesystem ?? app(CertificateFilesystemService::class);
52
-        $this->url_obfuscator_service = $url_obfuscator_service ?? app(UrlObfuscatorService::class);
53
-    }
35
+	/**
36
+	 * Constructor for SourceCertificate element
37
+	 *
38
+	 * @param string $label
39
+	 * @param CertificatesModule $module
40
+	 * @param CertificateFilesystemService $certif_filesystem
41
+	 * @param UrlObfuscatorService $url_obfuscator_service
42
+	 */
43
+	public function __construct(
44
+		string $label,
45
+		CertificatesModule $module,
46
+		CertificateFilesystemService $certif_filesystem = null,
47
+		UrlObfuscatorService $url_obfuscator_service = null
48
+	) {
49
+		parent::__construct($label, null);
50
+		$this->module = $module;
51
+		$this->certif_filesystem = $certif_filesystem ?? app(CertificateFilesystemService::class);
52
+		$this->url_obfuscator_service = $url_obfuscator_service ?? app(UrlObfuscatorService::class);
53
+	}
54 54
 
55
-    /**
56
-     * {@inheritDoc}
57
-     * @see \Fisharebest\Webtrees\Elements\AbstractElement::canonical()
58
-     */
59
-    public function canonical(string $value): string
60
-    {
61
-        return strtr($value, '\\', '/');
62
-    }
55
+	/**
56
+	 * {@inheritDoc}
57
+	 * @see \Fisharebest\Webtrees\Elements\AbstractElement::canonical()
58
+	 */
59
+	public function canonical(string $value): string
60
+	{
61
+		return strtr($value, '\\', '/');
62
+	}
63 63
 
64
-    /**
65
-     * {@inheritDoc}
66
-     * @see \Fisharebest\Webtrees\Elements\AbstractElement::edit()
67
-     */
68
-    public function edit(string $id, string $name, string $value, Tree $tree): string
69
-    {
70
-        list($city, $file) = explode('/', $this->canonical($value), 2) + ['', ''];
64
+	/**
65
+	 * {@inheritDoc}
66
+	 * @see \Fisharebest\Webtrees\Elements\AbstractElement::edit()
67
+	 */
68
+	public function edit(string $id, string $name, string $value, Tree $tree): string
69
+	{
70
+		list($city, $file) = explode('/', $this->canonical($value), 2) + ['', ''];
71 71
 
72
-        $cities = array_map(function (string $item): array {
73
-            return [$this->url_obfuscator_service->obfuscate($item), $item];
74
-        }, $this->certif_filesystem->cities($tree));
72
+		$cities = array_map(function (string $item): array {
73
+			return [$this->url_obfuscator_service->obfuscate($item), $item];
74
+		}, $this->certif_filesystem->cities($tree));
75 75
 
76
-        return view($this->module->name() . '::components/edit-certificate', [
77
-            'module_name'   =>  $this->module->name(),
78
-            'tree'          =>  $tree,
79
-            'id'            =>  $id,
80
-            'name'          =>  $name,
81
-            'cities'        =>  $cities,
82
-            'value'         =>  $this->canonical($value),
83
-            'value_city'    =>  $city,
84
-            'value_file'    =>  $file,
85
-            'js_script_url' =>  $this->module->assetUrl('js/certificates.min.js')
86
-        ]);
87
-    }
76
+		return view($this->module->name() . '::components/edit-certificate', [
77
+			'module_name'   =>  $this->module->name(),
78
+			'tree'          =>  $tree,
79
+			'id'            =>  $id,
80
+			'name'          =>  $name,
81
+			'cities'        =>  $cities,
82
+			'value'         =>  $this->canonical($value),
83
+			'value_city'    =>  $city,
84
+			'value_file'    =>  $file,
85
+			'js_script_url' =>  $this->module->assetUrl('js/certificates.min.js')
86
+		]);
87
+	}
88 88
 }
Please login to merge, or discard this patch.
app/Module/Certificates/CertificatesModule.php 1 patch
Indentation   +175 added lines, -175 removed lines patch added patch discarded remove patch
@@ -44,180 +44,180 @@
 block discarded – undo
44 44
  * Certificates Module.
45 45
  */
46 46
 class CertificatesModule extends AbstractModule implements
47
-    ModuleMyArtJaubInterface,
48
-    ModuleConfigInterface,
49
-    ModuleGlobalInterface,
50
-    ModuleListInterface,
51
-    ModuleHookSubscriberInterface
47
+	ModuleMyArtJaubInterface,
48
+	ModuleConfigInterface,
49
+	ModuleGlobalInterface,
50
+	ModuleListInterface,
51
+	ModuleHookSubscriberInterface
52 52
 {
53
-    use ModuleMyArtJaubTrait {
54
-        ModuleMyArtJaubTrait::boot as traitMajBoot;
55
-    }
56
-    use ModuleConfigTrait;
57
-    use ModuleGlobalTrait;
58
-    use ModuleListTrait;
59
-
60
-    /**
61
-     * {@inheritDoc}
62
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::title()
63
-     */
64
-    public function title(): string
65
-    {
66
-        return /* I18N: Name of the “Certificates” module */ I18N::translate('Certificates');
67
-    }
68
-
69
-    /**
70
-     * {@inheritDoc}
71
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::description()
72
-     */
73
-    public function description(): string
74
-    {
75
-        //phpcs:ignore Generic.Files.LineLength.TooLong
76
-        return /* I18N: Description of the “Certificates” module */ I18N::translate('Display and edition of certificates linked to sources.');
77
-    }
78
-
79
-    /**
80
-     * {@inheritDoc}
81
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::boot()
82
-     */
83
-    public function boot(): void
84
-    {
85
-        $this->traitMajBoot();
86
-
87
-        Registry::elementFactory()->registerTags([
88
-            'FAM:SOUR:_ACT'     =>  new SourceCertificate(I18N::translate('Certificate'), $this),
89
-            'FAM:*:SOUR:_ACT'   =>  new SourceCertificate(I18N::translate('Certificate'), $this),
90
-            'INDI:SOUR:_ACT'    =>  new SourceCertificate(I18N::translate('Certificate'), $this),
91
-            'INDI:*:SOUR:_ACT'  =>  new SourceCertificate(I18N::translate('Certificate'), $this),
92
-            'OBJE:SOUR:_ACT'    =>  new SourceCertificate(I18N::translate('Certificate'), $this),
93
-            'OBJE:*:SOUR:_ACT'  =>  new SourceCertificate(I18N::translate('Certificate'), $this),
94
-            'NOTE:SOUR:_ACT'    =>  new SourceCertificate(I18N::translate('Certificate'), $this),
95
-            'NOTE:*:SOUR:_ACT'  =>  new SourceCertificate(I18N::translate('Certificate'), $this)
96
-        ]);
97
-
98
-        Registry::elementFactory()->registerSubTags([
99
-            'FAM:SOUR'      =>  [['_ACT', '0:1']],
100
-            'FAM:*:SOUR'    =>  [['_ACT', '0:1']],
101
-            'INDI:SOUR'     =>  [['_ACT', '0:1']],
102
-            'INDI:*:SOUR'   =>  [['_ACT', '0:1']],
103
-            'OBJE:SOUR'     =>  [['_ACT', '0:1']],
104
-            'OBJE:*:SOUR'   =>  [['_ACT', '0:1']],
105
-            'NOTE:SOUR'     =>  [['_ACT', '0:1']],
106
-            'NOTE:*:SOUR'   =>  [['_ACT', '0:1']]
107
-        ]);
108
-    }
109
-
110
-    /**
111
-     * {@inheritDoc}
112
-     * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes()
113
-     */
114
-    public function loadRoutes($router): void
115
-    {
116
-        $router->attach('', '', static function (Map $router): void {
117
-
118
-            $router->attach('', '/module-maj/certificates', static function (Map $router): void {
119
-
120
-                $router->attach('', '/admin', static function (Map $router): void {
121
-
122
-                    $router->get(AdminConfigPage::class, '/config{/tree}', AdminConfigPage::class);
123
-                    $router->post(AdminConfigAction::class, '/config/{tree}', AdminConfigAction::class)
124
-                        ->extras([
125
-                            'middleware' => [
126
-                                AuthManager::class,
127
-                            ],
128
-                        ]);
129
-                });
130
-
131
-                $router->get(AutoCompleteFile::class, '/autocomplete/file/{tree}/{query}', AutoCompleteFile::class)
132
-                    ->extras([
133
-                        'middleware'            =>  [AuthTreePreference::class],
134
-                        'permission_preference' =>  'MAJ_CERTIF_SHOW_CERT'
135
-                    ]);
136
-
137
-                $router->get(CertificatesList::class, '/list/{tree}{/cityobf}', CertificatesList::class)
138
-                    ->extras([
139
-                        'middleware'            =>  [AuthTreePreference::class],
140
-                        'permission_preference' =>  'MAJ_CERTIF_SHOW_CERT'
141
-                    ]);
142
-
143
-                $router->attach('', '/certificate/{tree}/{cid}', static function (Map $router): void {
144
-
145
-                    $router->extras([
146
-                        'middleware'            =>  [AuthTreePreference::class],
147
-                        'permission_preference' =>  'MAJ_CERTIF_SHOW_CERT'
148
-                    ]);
149
-
150
-                    $router->get(CertificatePage::class, '', CertificatePage::class);
151
-                    $router->get(CertificateImage::class, '/image', CertificateImage::class);
152
-                });
153
-            });
154
-        });
155
-    }
156
-
157
-    /**
158
-     * {@inheritDoc}
159
-     * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion()
160
-     */
161
-    public function customModuleVersion(): string
162
-    {
163
-        return '2.1.3-v.1';
164
-    }
165
-
166
-    /**
167
-     * {@inheritDoc}
168
-     * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink()
169
-     */
170
-    public function getConfigLink(): string
171
-    {
172
-        return route(AdminConfigPage::class);
173
-    }
174
-
175
-    /**
176
-     * {@inheritDoc}
177
-     * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::headContent()
178
-     */
179
-    public function headContent(): string
180
-    {
181
-        return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">';
182
-    }
183
-
184
-    /**
185
-     * {@inheritDoc}
186
-     * @see \Fisharebest\Webtrees\Module\ModuleListInterface::listUrl()
187
-     *
188
-     * @param array<bool|int|string|array<mixed>|null> $parameters
189
-     */
190
-    public function listUrl(Tree $tree, array $parameters = []): string
191
-    {
192
-        return route(CertificatesList::class, ['tree' => $tree->name() ] + $parameters);
193
-    }
194
-
195
-    /**
196
-     * {@inheritDoc}
197
-     * @see \Fisharebest\Webtrees\Module\ModuleListInterface::listMenuClass()
198
-     */
199
-    public function listMenuClass(): string
200
-    {
201
-        return 'menu-maj-certificates';
202
-    }
203
-
204
-    /**
205
-     * {@inheritDoc}
206
-     * @see \Fisharebest\Webtrees\Module\ModuleListInterface::listIsEmpty()
207
-     */
208
-    public function listIsEmpty(Tree $tree): bool
209
-    {
210
-        return Auth::accessLevel($tree) > (int) $tree->getPreference('MAJ_CERTIF_SHOW_CERT', (string) Auth::PRIV_HIDE);
211
-    }
212
-
213
-    /**
214
-     * {@inheritDoc}
215
-     * @see \MyArtJaub\Webtrees\Contracts\Hooks\ModuleHookSubscriberInterface::listSubscribedHooks()
216
-     */
217
-    public function listSubscribedHooks(): array
218
-    {
219
-        return [
220
-            app()->makeWith(SourceCertificateIconHook::class, ['module' => $this])
221
-        ];
222
-    }
53
+	use ModuleMyArtJaubTrait {
54
+		ModuleMyArtJaubTrait::boot as traitMajBoot;
55
+	}
56
+	use ModuleConfigTrait;
57
+	use ModuleGlobalTrait;
58
+	use ModuleListTrait;
59
+
60
+	/**
61
+	 * {@inheritDoc}
62
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::title()
63
+	 */
64
+	public function title(): string
65
+	{
66
+		return /* I18N: Name of the “Certificates” module */ I18N::translate('Certificates');
67
+	}
68
+
69
+	/**
70
+	 * {@inheritDoc}
71
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::description()
72
+	 */
73
+	public function description(): string
74
+	{
75
+		//phpcs:ignore Generic.Files.LineLength.TooLong
76
+		return /* I18N: Description of the “Certificates” module */ I18N::translate('Display and edition of certificates linked to sources.');
77
+	}
78
+
79
+	/**
80
+	 * {@inheritDoc}
81
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::boot()
82
+	 */
83
+	public function boot(): void
84
+	{
85
+		$this->traitMajBoot();
86
+
87
+		Registry::elementFactory()->registerTags([
88
+			'FAM:SOUR:_ACT'     =>  new SourceCertificate(I18N::translate('Certificate'), $this),
89
+			'FAM:*:SOUR:_ACT'   =>  new SourceCertificate(I18N::translate('Certificate'), $this),
90
+			'INDI:SOUR:_ACT'    =>  new SourceCertificate(I18N::translate('Certificate'), $this),
91
+			'INDI:*:SOUR:_ACT'  =>  new SourceCertificate(I18N::translate('Certificate'), $this),
92
+			'OBJE:SOUR:_ACT'    =>  new SourceCertificate(I18N::translate('Certificate'), $this),
93
+			'OBJE:*:SOUR:_ACT'  =>  new SourceCertificate(I18N::translate('Certificate'), $this),
94
+			'NOTE:SOUR:_ACT'    =>  new SourceCertificate(I18N::translate('Certificate'), $this),
95
+			'NOTE:*:SOUR:_ACT'  =>  new SourceCertificate(I18N::translate('Certificate'), $this)
96
+		]);
97
+
98
+		Registry::elementFactory()->registerSubTags([
99
+			'FAM:SOUR'      =>  [['_ACT', '0:1']],
100
+			'FAM:*:SOUR'    =>  [['_ACT', '0:1']],
101
+			'INDI:SOUR'     =>  [['_ACT', '0:1']],
102
+			'INDI:*:SOUR'   =>  [['_ACT', '0:1']],
103
+			'OBJE:SOUR'     =>  [['_ACT', '0:1']],
104
+			'OBJE:*:SOUR'   =>  [['_ACT', '0:1']],
105
+			'NOTE:SOUR'     =>  [['_ACT', '0:1']],
106
+			'NOTE:*:SOUR'   =>  [['_ACT', '0:1']]
107
+		]);
108
+	}
109
+
110
+	/**
111
+	 * {@inheritDoc}
112
+	 * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes()
113
+	 */
114
+	public function loadRoutes($router): void
115
+	{
116
+		$router->attach('', '', static function (Map $router): void {
117
+
118
+			$router->attach('', '/module-maj/certificates', static function (Map $router): void {
119
+
120
+				$router->attach('', '/admin', static function (Map $router): void {
121
+
122
+					$router->get(AdminConfigPage::class, '/config{/tree}', AdminConfigPage::class);
123
+					$router->post(AdminConfigAction::class, '/config/{tree}', AdminConfigAction::class)
124
+						->extras([
125
+							'middleware' => [
126
+								AuthManager::class,
127
+							],
128
+						]);
129
+				});
130
+
131
+				$router->get(AutoCompleteFile::class, '/autocomplete/file/{tree}/{query}', AutoCompleteFile::class)
132
+					->extras([
133
+						'middleware'            =>  [AuthTreePreference::class],
134
+						'permission_preference' =>  'MAJ_CERTIF_SHOW_CERT'
135
+					]);
136
+
137
+				$router->get(CertificatesList::class, '/list/{tree}{/cityobf}', CertificatesList::class)
138
+					->extras([
139
+						'middleware'            =>  [AuthTreePreference::class],
140
+						'permission_preference' =>  'MAJ_CERTIF_SHOW_CERT'
141
+					]);
142
+
143
+				$router->attach('', '/certificate/{tree}/{cid}', static function (Map $router): void {
144
+
145
+					$router->extras([
146
+						'middleware'            =>  [AuthTreePreference::class],
147
+						'permission_preference' =>  'MAJ_CERTIF_SHOW_CERT'
148
+					]);
149
+
150
+					$router->get(CertificatePage::class, '', CertificatePage::class);
151
+					$router->get(CertificateImage::class, '/image', CertificateImage::class);
152
+				});
153
+			});
154
+		});
155
+	}
156
+
157
+	/**
158
+	 * {@inheritDoc}
159
+	 * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion()
160
+	 */
161
+	public function customModuleVersion(): string
162
+	{
163
+		return '2.1.3-v.1';
164
+	}
165
+
166
+	/**
167
+	 * {@inheritDoc}
168
+	 * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink()
169
+	 */
170
+	public function getConfigLink(): string
171
+	{
172
+		return route(AdminConfigPage::class);
173
+	}
174
+
175
+	/**
176
+	 * {@inheritDoc}
177
+	 * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::headContent()
178
+	 */
179
+	public function headContent(): string
180
+	{
181
+		return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">';
182
+	}
183
+
184
+	/**
185
+	 * {@inheritDoc}
186
+	 * @see \Fisharebest\Webtrees\Module\ModuleListInterface::listUrl()
187
+	 *
188
+	 * @param array<bool|int|string|array<mixed>|null> $parameters
189
+	 */
190
+	public function listUrl(Tree $tree, array $parameters = []): string
191
+	{
192
+		return route(CertificatesList::class, ['tree' => $tree->name() ] + $parameters);
193
+	}
194
+
195
+	/**
196
+	 * {@inheritDoc}
197
+	 * @see \Fisharebest\Webtrees\Module\ModuleListInterface::listMenuClass()
198
+	 */
199
+	public function listMenuClass(): string
200
+	{
201
+		return 'menu-maj-certificates';
202
+	}
203
+
204
+	/**
205
+	 * {@inheritDoc}
206
+	 * @see \Fisharebest\Webtrees\Module\ModuleListInterface::listIsEmpty()
207
+	 */
208
+	public function listIsEmpty(Tree $tree): bool
209
+	{
210
+		return Auth::accessLevel($tree) > (int) $tree->getPreference('MAJ_CERTIF_SHOW_CERT', (string) Auth::PRIV_HIDE);
211
+	}
212
+
213
+	/**
214
+	 * {@inheritDoc}
215
+	 * @see \MyArtJaub\Webtrees\Contracts\Hooks\ModuleHookSubscriberInterface::listSubscribedHooks()
216
+	 */
217
+	public function listSubscribedHooks(): array
218
+	{
219
+		return [
220
+			app()->makeWith(SourceCertificateIconHook::class, ['module' => $this])
221
+		];
222
+	}
223 223
 }
Please login to merge, or discard this patch.