Passed
Push — feature/code-analysis ( 00c5b4...e321b8 )
by Jonathan
13:27
created
app/Module/Certificates/Model/Certificate.php 1 patch
Indentation   +187 added lines, -187 removed lines patch added patch discarded remove patch
@@ -25,191 +25,191 @@
 block discarded – undo
25 25
  */
26 26
 class Certificate
27 27
 {
28
-    /**
29
-     * Pattern to extract information from a file name.
30
-     * Specific to the author's workflow.
31
-     * @var string
32
-     */
33
-    private const FILENAME_PATTERN = '/^(?<year>\d{1,4})(\.(?<month>\d{1,2}))?(\.(?<day>\d{1,2}))?( (?<type>[A-Z]{1,2}))?\s(?<descr>.*)/'; //phpcs:ignore Generic.Files.LineLength.TooLong
34
-
35
-    private Tree $tree;
36
-    private string $path;
37
-    private ?string $city = null;
38
-    private ?string $basename = null;
39
-    private ?string $filename = null;
40
-    private ?string $extension = null;
41
-    private ?string $type = null;
42
-    private ?string $description = null;
43
-    private ?Date $date = null;
44
-
45
-    /**
46
-     * Contructor for Certificate
47
-     *
48
-     * @param Tree $tree
49
-     * @param string $path
50
-     */
51
-    public function __construct(Tree $tree, string $path)
52
-    {
53
-        $this->tree = $tree;
54
-        $this->path = $path;
55
-        $this->extractDataFromPath($path);
56
-    }
57
-
58
-    /**
59
-     * Populate fields from the filename, based on a predeterminate pattern.
60
-     * Logic specific to the author.
61
-     *
62
-     * @param string $path
63
-     */
64
-    protected function extractDataFromPath(string $path): void
65
-    {
66
-        $path_parts = pathinfo($this->gedcomPath());
67
-        $this->city = $path_parts['dirname'] ?? '';
68
-        $this->basename = $path_parts['basename'];
69
-        $this->filename = $path_parts['filename'];
70
-        $this->extension = strtoupper($path_parts['extension'] ?? '');
71
-
72
-        if (preg_match(self::FILENAME_PATTERN, $this->filename, $match) === 1) {
73
-            $this->type = $match['type'];
74
-            $this->description = $match['descr'];
75
-
76
-            $month_date = DateTime::createFromFormat('m', $match['month']);
77
-            $month = $month_date !== false ? strtoupper($month_date->format('M')) : '';
78
-
79
-            $this->date = new Date(sprintf('%s %s %s', $match['day'], $month, $match['year']));
80
-        } else {
81
-            $this->description = $this->filename;
82
-        }
83
-    }
84
-
85
-    /**
86
-     * Get the family tree of the certificate
87
-     *
88
-     * @return Tree
89
-     */
90
-    public function tree(): Tree
91
-    {
92
-        return $this->tree;
93
-    }
94
-
95
-    /**
96
-     * Get the path of the certificate in the file system.
97
-     *
98
-     * @return string
99
-     */
100
-    public function path(): string
101
-    {
102
-        return $this->path;
103
-    }
104
-
105
-    /**
106
-     * The the path of the certificate, in a Gedcom canonical form.
107
-     *
108
-     * @return string
109
-     */
110
-    public function gedcomPath(): string
111
-    {
112
-        return str_replace('\\', '/', $this->path);
113
-    }
114
-
115
-    /**
116
-     * Get the certificate name.
117
-     *
118
-     * @return string
119
-     */
120
-    public function name(): string
121
-    {
122
-        return $this->filename ?? '';
123
-    }
124
-
125
-    /**
126
-     * Get the certificate file name.
127
-     *
128
-     * @return string
129
-     */
130
-    public function filename(): string
131
-    {
132
-        return $this->basename ?? '';
133
-    }
134
-
135
-    /**
136
-     * Get the certificate's city (the first level folder).
137
-     *
138
-     * @return string
139
-     */
140
-    public function city(): string
141
-    {
142
-        return $this->city ?? '';
143
-    }
144
-
145
-    /**
146
-     * Get the certificate's date. Extracted from the file name.
147
-     *
148
-     * @return Date
149
-     */
150
-    public function date(): Date
151
-    {
152
-        return $this->date ?? new Date('');
153
-    }
154
-
155
-    /**
156
-     * Get the certificate's type. Extracted from the file name.
157
-     *
158
-     * @return string
159
-     */
160
-    public function type(): string
161
-    {
162
-        return $this->type ?? '';
163
-    }
164
-
165
-    /**
166
-     * Get the certificate's description.  Extracted from the file name.
167
-     * @return string
168
-     */
169
-    public function description(): string
170
-    {
171
-        return $this->description ?? '';
172
-    }
173
-
174
-    /**
175
-     * Get the certificate's description to be used for sorting.
176
-     * This is based on surnames (at least 3 letters) found in the file name.
177
-     *
178
-     * @return string
179
-     */
180
-    public function sortDescription(): string
181
-    {
182
-        $sort_prefix = '';
183
-        if (preg_match_all('/\b([A-Z]{3,})\b/', $this->description(), $matches, PREG_SET_ORDER) >= 1) {
184
-            $sort_prefix = implode('_', array_map(function ($match) {
185
-                return $match[1];
186
-            }, $matches)) . '_';
187
-        }
188
-        return $sort_prefix . $this->description();
189
-    }
190
-
191
-    /**
192
-     * Get the certificate's MIME type.
193
-     *
194
-     * @return string
195
-     */
196
-    public function mimeType(): string
197
-    {
198
-        return Mime::TYPES[$this->extension] ?? Mime::DEFAULT_TYPE;
199
-    }
200
-
201
-    /**
202
-     * Get the base parameters to be used in url referencing the certificate.
203
-     *
204
-     * @param UrlObfuscatorService $url_obfuscator_service
205
-     * @return array{tree: string, cid: mixed}
206
-     */
207
-    public function urlParameters(UrlObfuscatorService $url_obfuscator_service = null): array
208
-    {
209
-        $url_obfuscator_service = $url_obfuscator_service ?? app(UrlObfuscatorService::class);
210
-        return [
211
-            'tree' => $this->tree->name(),
212
-            'cid' => $url_obfuscator_service->obfuscate($this->path)
213
-        ];
214
-    }
28
+	/**
29
+	 * Pattern to extract information from a file name.
30
+	 * Specific to the author's workflow.
31
+	 * @var string
32
+	 */
33
+	private const FILENAME_PATTERN = '/^(?<year>\d{1,4})(\.(?<month>\d{1,2}))?(\.(?<day>\d{1,2}))?( (?<type>[A-Z]{1,2}))?\s(?<descr>.*)/'; //phpcs:ignore Generic.Files.LineLength.TooLong
34
+
35
+	private Tree $tree;
36
+	private string $path;
37
+	private ?string $city = null;
38
+	private ?string $basename = null;
39
+	private ?string $filename = null;
40
+	private ?string $extension = null;
41
+	private ?string $type = null;
42
+	private ?string $description = null;
43
+	private ?Date $date = null;
44
+
45
+	/**
46
+	 * Contructor for Certificate
47
+	 *
48
+	 * @param Tree $tree
49
+	 * @param string $path
50
+	 */
51
+	public function __construct(Tree $tree, string $path)
52
+	{
53
+		$this->tree = $tree;
54
+		$this->path = $path;
55
+		$this->extractDataFromPath($path);
56
+	}
57
+
58
+	/**
59
+	 * Populate fields from the filename, based on a predeterminate pattern.
60
+	 * Logic specific to the author.
61
+	 *
62
+	 * @param string $path
63
+	 */
64
+	protected function extractDataFromPath(string $path): void
65
+	{
66
+		$path_parts = pathinfo($this->gedcomPath());
67
+		$this->city = $path_parts['dirname'] ?? '';
68
+		$this->basename = $path_parts['basename'];
69
+		$this->filename = $path_parts['filename'];
70
+		$this->extension = strtoupper($path_parts['extension'] ?? '');
71
+
72
+		if (preg_match(self::FILENAME_PATTERN, $this->filename, $match) === 1) {
73
+			$this->type = $match['type'];
74
+			$this->description = $match['descr'];
75
+
76
+			$month_date = DateTime::createFromFormat('m', $match['month']);
77
+			$month = $month_date !== false ? strtoupper($month_date->format('M')) : '';
78
+
79
+			$this->date = new Date(sprintf('%s %s %s', $match['day'], $month, $match['year']));
80
+		} else {
81
+			$this->description = $this->filename;
82
+		}
83
+	}
84
+
85
+	/**
86
+	 * Get the family tree of the certificate
87
+	 *
88
+	 * @return Tree
89
+	 */
90
+	public function tree(): Tree
91
+	{
92
+		return $this->tree;
93
+	}
94
+
95
+	/**
96
+	 * Get the path of the certificate in the file system.
97
+	 *
98
+	 * @return string
99
+	 */
100
+	public function path(): string
101
+	{
102
+		return $this->path;
103
+	}
104
+
105
+	/**
106
+	 * The the path of the certificate, in a Gedcom canonical form.
107
+	 *
108
+	 * @return string
109
+	 */
110
+	public function gedcomPath(): string
111
+	{
112
+		return str_replace('\\', '/', $this->path);
113
+	}
114
+
115
+	/**
116
+	 * Get the certificate name.
117
+	 *
118
+	 * @return string
119
+	 */
120
+	public function name(): string
121
+	{
122
+		return $this->filename ?? '';
123
+	}
124
+
125
+	/**
126
+	 * Get the certificate file name.
127
+	 *
128
+	 * @return string
129
+	 */
130
+	public function filename(): string
131
+	{
132
+		return $this->basename ?? '';
133
+	}
134
+
135
+	/**
136
+	 * Get the certificate's city (the first level folder).
137
+	 *
138
+	 * @return string
139
+	 */
140
+	public function city(): string
141
+	{
142
+		return $this->city ?? '';
143
+	}
144
+
145
+	/**
146
+	 * Get the certificate's date. Extracted from the file name.
147
+	 *
148
+	 * @return Date
149
+	 */
150
+	public function date(): Date
151
+	{
152
+		return $this->date ?? new Date('');
153
+	}
154
+
155
+	/**
156
+	 * Get the certificate's type. Extracted from the file name.
157
+	 *
158
+	 * @return string
159
+	 */
160
+	public function type(): string
161
+	{
162
+		return $this->type ?? '';
163
+	}
164
+
165
+	/**
166
+	 * Get the certificate's description.  Extracted from the file name.
167
+	 * @return string
168
+	 */
169
+	public function description(): string
170
+	{
171
+		return $this->description ?? '';
172
+	}
173
+
174
+	/**
175
+	 * Get the certificate's description to be used for sorting.
176
+	 * This is based on surnames (at least 3 letters) found in the file name.
177
+	 *
178
+	 * @return string
179
+	 */
180
+	public function sortDescription(): string
181
+	{
182
+		$sort_prefix = '';
183
+		if (preg_match_all('/\b([A-Z]{3,})\b/', $this->description(), $matches, PREG_SET_ORDER) >= 1) {
184
+			$sort_prefix = implode('_', array_map(function ($match) {
185
+				return $match[1];
186
+			}, $matches)) . '_';
187
+		}
188
+		return $sort_prefix . $this->description();
189
+	}
190
+
191
+	/**
192
+	 * Get the certificate's MIME type.
193
+	 *
194
+	 * @return string
195
+	 */
196
+	public function mimeType(): string
197
+	{
198
+		return Mime::TYPES[$this->extension] ?? Mime::DEFAULT_TYPE;
199
+	}
200
+
201
+	/**
202
+	 * Get the base parameters to be used in url referencing the certificate.
203
+	 *
204
+	 * @param UrlObfuscatorService $url_obfuscator_service
205
+	 * @return array{tree: string, cid: mixed}
206
+	 */
207
+	public function urlParameters(UrlObfuscatorService $url_obfuscator_service = null): array
208
+	{
209
+		$url_obfuscator_service = $url_obfuscator_service ?? app(UrlObfuscatorService::class);
210
+		return [
211
+			'tree' => $this->tree->name(),
212
+			'cid' => $url_obfuscator_service->obfuscate($this->path)
213
+		];
214
+	}
215 215
 }
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(Map $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(Map $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.
app/Module/MiscExtensions/Hooks/TitlesCardHook.php 1 patch
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -25,68 +25,68 @@
 block discarded – undo
25 25
  */
26 26
 class TitlesCardHook implements NameAccordionExtenderInterface
27 27
 {
28
-    private ModuleInterface $module;
28
+	private ModuleInterface $module;
29 29
 
30
-    /**
31
-     * Constructor for TitlesCardHook
32
-     *
33
-     * @param ModuleInterface $module
34
-     */
35
-    public function __construct(ModuleInterface $module)
36
-    {
37
-        $this->module = $module;
38
-    }
30
+	/**
31
+	 * Constructor for TitlesCardHook
32
+	 *
33
+	 * @param ModuleInterface $module
34
+	 */
35
+	public function __construct(ModuleInterface $module)
36
+	{
37
+		$this->module = $module;
38
+	}
39 39
 
40
-    /**
41
-     * {@inheritDoc}
42
-     * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookInterface::module()
43
-     */
44
-    public function module(): ModuleInterface
45
-    {
46
-        return $this->module;
47
-    }
40
+	/**
41
+	 * {@inheritDoc}
42
+	 * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookInterface::module()
43
+	 */
44
+	public function module(): ModuleInterface
45
+	{
46
+		return $this->module;
47
+	}
48 48
 
49
-    /**
50
-     * {@inheritDoc}
51
-     * @see \MyArtJaub\Webtrees\Contracts\Hooks\NameAccordionExtenderInterface::accordionCard()
52
-     */
53
-    public function accordionCard(Individual $individual): string
54
-    {
55
-        $title_separator = $this->module->getPreference('MAJ_TITLE_PREFIX');
56
-        if ($title_separator === '') {
57
-            return '';
58
-        }
49
+	/**
50
+	 * {@inheritDoc}
51
+	 * @see \MyArtJaub\Webtrees\Contracts\Hooks\NameAccordionExtenderInterface::accordionCard()
52
+	 */
53
+	public function accordionCard(Individual $individual): string
54
+	{
55
+		$title_separator = $this->module->getPreference('MAJ_TITLE_PREFIX');
56
+		if ($title_separator === '') {
57
+			return '';
58
+		}
59 59
 
60
-        $titles = $this->individualTitles($individual, '/(.*?) ((' . $title_separator .  ')(.*))/i');
60
+		$titles = $this->individualTitles($individual, '/(.*?) ((' . $title_separator .  ')(.*))/i');
61 61
 
62
-        return count($titles) === 0 ? '' :
63
-            view($this->module()->name() . '::components/accordion-item-titles', [ 'titles' => $titles ]);
64
-    }
62
+		return count($titles) === 0 ? '' :
63
+			view($this->module()->name() . '::components/accordion-item-titles', [ 'titles' => $titles ]);
64
+	}
65 65
 
66
-    /**
67
-     * Extract the individual titles from the TITL tags.
68
-     * Split the title based on a pattern to identify the title and the land it refers to.
69
-     *
70
-     * @param Individual $individual
71
-     * @param non-empty-string $pattern
72
-     * @return array<string, string[]>
73
-     */
74
-    protected function individualTitles(Individual $individual, string $pattern): array
75
-    {
76
-        $titles_list = [];
77
-        /** @var \Illuminate\Support\Collection<string> $titles */
78
-        $titles = $individual->facts(['TITL'])
79
-            ->sortByDesc(fn(Fact $fact) => $fact->date()->julianDay())
80
-            ->map(fn(Fact $fact) => $fact->value());
66
+	/**
67
+	 * Extract the individual titles from the TITL tags.
68
+	 * Split the title based on a pattern to identify the title and the land it refers to.
69
+	 *
70
+	 * @param Individual $individual
71
+	 * @param non-empty-string $pattern
72
+	 * @return array<string, string[]>
73
+	 */
74
+	protected function individualTitles(Individual $individual, string $pattern): array
75
+	{
76
+		$titles_list = [];
77
+		/** @var \Illuminate\Support\Collection<string> $titles */
78
+		$titles = $individual->facts(['TITL'])
79
+			->sortByDesc(fn(Fact $fact) => $fact->date()->julianDay())
80
+			->map(fn(Fact $fact) => $fact->value());
81 81
 
82
-        foreach ($titles as $title) {
83
-            if (preg_match($pattern, $title, $match) === 1) {
84
-                /** @var array<int, string> $match */
85
-                $titles_list[$match[1]][] = trim($match[2]);
86
-            } else {
87
-                $titles_list[$title][] = '';
88
-            }
89
-        }
90
-        return $titles_list;
91
-    }
82
+		foreach ($titles as $title) {
83
+			if (preg_match($pattern, $title, $match) === 1) {
84
+				/** @var array<int, string> $match */
85
+				$titles_list[$match[1]][] = trim($match[2]);
86
+			} else {
87
+				$titles_list[$title][] = '';
88
+			}
89
+		}
90
+		return $titles_list;
91
+	}
92 92
 }
Please login to merge, or discard this patch.
app/Module/MiscExtensions/Factories/LegacyXrefFactory.php 1 patch
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -23,67 +23,67 @@
 block discarded – undo
23 23
  */
24 24
 class LegacyXrefFactory extends XrefFactory
25 25
 {
26
-    protected const TYPE_TO_PREFIX = [
27
-        'INDI' => 'I',
28
-        'FAM'  => 'F',
29
-        'OBJE' => 'M',
30
-        'NOTE' => 'N',
31
-        'SOUR' => 'S',
32
-        'REPO' => 'R',
33
-    ];
26
+	protected const TYPE_TO_PREFIX = [
27
+		'INDI' => 'I',
28
+		'FAM'  => 'F',
29
+		'OBJE' => 'M',
30
+		'NOTE' => 'N',
31
+		'SOUR' => 'S',
32
+		'REPO' => 'R',
33
+	];
34 34
 
35
-    /**
36
-     * {@inheritDoc}
37
-     * @see \Fisharebest\Webtrees\Factories\XrefFactory::make()
38
-     */
39
-    public function make(string $record_type): string
40
-    {
41
-        $prefix = static::TYPE_TO_PREFIX[$record_type] ?? 'X';
35
+	/**
36
+	 * {@inheritDoc}
37
+	 * @see \Fisharebest\Webtrees\Factories\XrefFactory::make()
38
+	 */
39
+	public function make(string $record_type): string
40
+	{
41
+		$prefix = static::TYPE_TO_PREFIX[$record_type] ?? 'X';
42 42
 
43
-        return $this->generate($prefix, '');
44
-    }
43
+		return $this->generate($prefix, '');
44
+	}
45 45
 
46
-    /**
47
-     * {@inheritDoc}
48
-     * @see \Fisharebest\Webtrees\Factories\XrefFactory::generate()
49
-     */
50
-    protected function generate($prefix, $suffix): string
51
-    {
52
-        $tree = app(Tree::class);
53
-        if (!$tree instanceof Tree) {
54
-            return parent::generate($prefix, $suffix);
55
-        }
46
+	/**
47
+	 * {@inheritDoc}
48
+	 * @see \Fisharebest\Webtrees\Factories\XrefFactory::generate()
49
+	 */
50
+	protected function generate($prefix, $suffix): string
51
+	{
52
+		$tree = app(Tree::class);
53
+		if (!$tree instanceof Tree) {
54
+			return parent::generate($prefix, $suffix);
55
+		}
56 56
 
57
-        $setting_name = 'MAJ_MISC_XREF_NEXT_' . $prefix;
58
-        // Lock the row, so that only one new XREF may be generated at a time.
59
-        $num = (int) DB::table('gedcom_setting')
60
-            ->where('gedcom_id', '=', $tree->id())
61
-            ->where('setting_name', '=', $setting_name)
62
-            ->lockForUpdate()
63
-            ->value('setting_value');
57
+		$setting_name = 'MAJ_MISC_XREF_NEXT_' . $prefix;
58
+		// Lock the row, so that only one new XREF may be generated at a time.
59
+		$num = (int) DB::table('gedcom_setting')
60
+			->where('gedcom_id', '=', $tree->id())
61
+			->where('setting_name', '=', $setting_name)
62
+			->lockForUpdate()
63
+			->value('setting_value');
64 64
 
65
-        $increment = 1.0;
66
-        do {
67
-            $num += (int) $increment;
65
+		$increment = 1.0;
66
+		do {
67
+			$num += (int) $increment;
68 68
 
69
-            // This exponential increment allows us to scan over large blocks of
70
-            // existing data in a reasonable time.
71
-            $increment *= 1.01;
69
+			// This exponential increment allows us to scan over large blocks of
70
+			// existing data in a reasonable time.
71
+			$increment *= 1.01;
72 72
 
73
-            $xref = $prefix . $num . $suffix;
73
+			$xref = $prefix . $num . $suffix;
74 74
 
75
-            // Records may already exist with this sequence number.
76
-            $already_used =
77
-                DB::table('individuals')->where('i_file', '=', $tree->id())->where('i_id', '=', $xref)->exists() ||
78
-                DB::table('families')->where('f_file', '=', $tree->id())->where('f_id', '=', $xref)->exists() ||
79
-                DB::table('sources')->where('s_file', '=', $tree->id())->where('s_id', '=', $xref)->exists() ||
80
-                DB::table('media')->where('m_file', '=', $tree->id())->where('m_id', '=', $xref)->exists() ||
81
-                DB::table('other')->where('o_file', '=', $tree->id())->where('o_id', '=', $xref)->exists() ||
82
-                DB::table('change')->where('gedcom_id', '=', $tree->id())->where('xref', '=', $xref)->exists();
83
-        } while ($already_used);
75
+			// Records may already exist with this sequence number.
76
+			$already_used =
77
+				DB::table('individuals')->where('i_file', '=', $tree->id())->where('i_id', '=', $xref)->exists() ||
78
+				DB::table('families')->where('f_file', '=', $tree->id())->where('f_id', '=', $xref)->exists() ||
79
+				DB::table('sources')->where('s_file', '=', $tree->id())->where('s_id', '=', $xref)->exists() ||
80
+				DB::table('media')->where('m_file', '=', $tree->id())->where('m_id', '=', $xref)->exists() ||
81
+				DB::table('other')->where('o_file', '=', $tree->id())->where('o_id', '=', $xref)->exists() ||
82
+				DB::table('change')->where('gedcom_id', '=', $tree->id())->where('xref', '=', $xref)->exists();
83
+		} while ($already_used);
84 84
 
85
-        $tree->setPreference($setting_name, (string) $num);
85
+		$tree->setPreference($setting_name, (string) $num);
86 86
 
87
-        return $xref;
88
-    }
87
+		return $xref;
88
+	}
89 89
 }
Please login to merge, or discard this patch.
app/Module/MiscExtensions/Http/RequestHandlers/AdminConfigAction.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -30,54 +30,54 @@
 block discarded – undo
30 30
  */
31 31
 class AdminConfigAction implements RequestHandlerInterface
32 32
 {
33
-    private ?MiscExtensionsModule $module;
33
+	private ?MiscExtensionsModule $module;
34 34
 
35
-    /**
36
-     * Constructor for AdminConfigPage Request Handler
37
-     *
38
-     * @param ModuleService $module_service
39
-     */
40
-    public function __construct(ModuleService $module_service)
41
-    {
42
-        $this->module = $module_service->findByInterface(MiscExtensionsModule::class)->first();
43
-    }
35
+	/**
36
+	 * Constructor for AdminConfigPage Request Handler
37
+	 *
38
+	 * @param ModuleService $module_service
39
+	 */
40
+	public function __construct(ModuleService $module_service)
41
+	{
42
+		$this->module = $module_service->findByInterface(MiscExtensionsModule::class)->first();
43
+	}
44 44
 
45
-    /**
46
-     * {@inheritDoc}
47
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
48
-     */
49
-    public function handle(ServerRequestInterface $request): ResponseInterface
50
-    {
51
-        if ($this->module === null) {
52
-            FlashMessages::addMessage(
53
-                I18N::translate('The attached module could not be found.'),
54
-                'danger'
55
-            );
56
-            return Registry::responseFactory()->redirect(HomePage::class);
57
-        }
45
+	/**
46
+	 * {@inheritDoc}
47
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
48
+	 */
49
+	public function handle(ServerRequestInterface $request): ResponseInterface
50
+	{
51
+		if ($this->module === null) {
52
+			FlashMessages::addMessage(
53
+				I18N::translate('The attached module could not be found.'),
54
+				'danger'
55
+			);
56
+			return Registry::responseFactory()->redirect(HomePage::class);
57
+		}
58 58
 
59
-        $this->module->setPreference(
60
-            'MAJ_TITLE_PREFIX',
61
-            Validator::parsedBody($request)->string('MAJ_TITLE_PREFIX', '')
62
-        );
63
-        $this->module->setPreference(
64
-            'MAJ_DISPLAY_CNIL',
65
-            (string) Validator::parsedBody($request)->integer('MAJ_DISPLAY_CNIL', 0)
66
-        );
67
-        $this->module->setPreference(
68
-            'MAJ_CNIL_REFERENCE',
69
-            Validator::parsedBody($request)->string('MAJ_CNIL_REFERENCE', '')
70
-        );
71
-        $this->module->setPreference(
72
-            'MAJ_USE_LEGACY_XREF',
73
-            (string) Validator::parsedBody($request)->integer('MAJ_USE_LEGACY_XREF', 0)
74
-        );
59
+		$this->module->setPreference(
60
+			'MAJ_TITLE_PREFIX',
61
+			Validator::parsedBody($request)->string('MAJ_TITLE_PREFIX', '')
62
+		);
63
+		$this->module->setPreference(
64
+			'MAJ_DISPLAY_CNIL',
65
+			(string) Validator::parsedBody($request)->integer('MAJ_DISPLAY_CNIL', 0)
66
+		);
67
+		$this->module->setPreference(
68
+			'MAJ_CNIL_REFERENCE',
69
+			Validator::parsedBody($request)->string('MAJ_CNIL_REFERENCE', '')
70
+		);
71
+		$this->module->setPreference(
72
+			'MAJ_USE_LEGACY_XREF',
73
+			(string) Validator::parsedBody($request)->integer('MAJ_USE_LEGACY_XREF', 0)
74
+		);
75 75
 
76
-        FlashMessages::addMessage(
77
-            I18N::translate('The preferences for the module “%s” have been updated.', $this->module->title()),
78
-            'success'
79
-        );
76
+		FlashMessages::addMessage(
77
+			I18N::translate('The preferences for the module “%s” have been updated.', $this->module->title()),
78
+			'success'
79
+		);
80 80
 
81
-        return Registry::responseFactory()->redirect(AdminConfigPage::class);
82
-    }
81
+		return Registry::responseFactory()->redirect(AdminConfigPage::class);
82
+	}
83 83
 }
Please login to merge, or discard this patch.
app/Module/MiscExtensions/MiscExtensionsModule.php 1 patch
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -34,93 +34,93 @@
 block discarded – undo
34 34
  * Provide miscellaneous improvements to webtrees.
35 35
  */
36 36
 class MiscExtensionsModule extends AbstractModule implements
37
-    ModuleMyArtJaubInterface,
38
-    ModuleConfigInterface,
39
-    ModuleHookSubscriberInterface
37
+	ModuleMyArtJaubInterface,
38
+	ModuleConfigInterface,
39
+	ModuleHookSubscriberInterface
40 40
 {
41
-    use ModuleMyArtJaubTrait {
42
-        boot as traitBoot;
43
-    }
44
-    use ModuleConfigTrait;
45
-
46
-    /**
47
-     * {@inheritDoc}
48
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::title()
49
-     */
50
-    public function title(): string
51
-    {
52
-        return /* I18N: Name of the “MiscExtensions” module */ I18N::translate('Miscellaneous extensions');
53
-    }
54
-
55
-    /**
56
-     * {@inheritDoc}
57
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::description()
58
-     */
59
-    public function description(): string
60
-    {
61
-        //phpcs:ignore Generic.Files.LineLength.TooLong
62
-        return /* I18N: Description of the “MiscExtensions” module */ I18N::translate('Miscellaneous extensions for webtrees.');
63
-    }
64
-
65
-    /**
66
-     * {@inheritDoc}
67
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::boot()
68
-     */
69
-    public function boot(): void
70
-    {
71
-        $this->traitBoot();
72
-        View::registerCustomView('::modules/privacy-policy/page', $this->name() . '::privacy-policy');
73
-
74
-        if ((int) $this->getPreference('MAJ_USE_LEGACY_XREF') === 1) {
75
-            Registry::xrefFactory(new LegacyXrefFactory());
76
-        }
77
-    }
78
-
79
-    /**
80
-     * {@inheritDoc}
81
-     * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes()
82
-     */
83
-    public function loadRoutes(Map $router): void
84
-    {
85
-        $router->attach('', '', static function (Map $router): void {
86
-
87
-            $router->attach('', '/module-maj/misc', static function (Map $router): void {
88
-
89
-                $router->attach('', '/config/admin', static function (Map $router): void {
90
-
91
-                    $router->get(AdminConfigPage::class, '', AdminConfigPage::class);
92
-                    $router->post(AdminConfigAction::class, '', AdminConfigAction::class);
93
-                });
94
-            });
95
-        });
96
-    }
97
-
98
-    /**
99
-     * {@inheritDoc}
100
-     * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion()
101
-     */
102
-    public function customModuleVersion(): string
103
-    {
104
-        return '2.1.15-v.1';
105
-    }
106
-
107
-    /**
108
-     * {@inheritDoc}
109
-     * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink()
110
-     */
111
-    public function getConfigLink(): string
112
-    {
113
-        return route(AdminConfigPage::class);
114
-    }
115
-
116
-    /**
117
-     * {@inheritDoc}
118
-     * @see \MyArtJaub\Webtrees\Contracts\Hooks\ModuleHookSubscriberInterface::listSubscribedHooks()
119
-     */
120
-    public function listSubscribedHooks(): array
121
-    {
122
-        return [
123
-            app()->makeWith(TitlesCardHook::class, [ 'module' => $this ])
124
-        ];
125
-    }
41
+	use ModuleMyArtJaubTrait {
42
+		boot as traitBoot;
43
+	}
44
+	use ModuleConfigTrait;
45
+
46
+	/**
47
+	 * {@inheritDoc}
48
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::title()
49
+	 */
50
+	public function title(): string
51
+	{
52
+		return /* I18N: Name of the “MiscExtensions” module */ I18N::translate('Miscellaneous extensions');
53
+	}
54
+
55
+	/**
56
+	 * {@inheritDoc}
57
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::description()
58
+	 */
59
+	public function description(): string
60
+	{
61
+		//phpcs:ignore Generic.Files.LineLength.TooLong
62
+		return /* I18N: Description of the “MiscExtensions” module */ I18N::translate('Miscellaneous extensions for webtrees.');
63
+	}
64
+
65
+	/**
66
+	 * {@inheritDoc}
67
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::boot()
68
+	 */
69
+	public function boot(): void
70
+	{
71
+		$this->traitBoot();
72
+		View::registerCustomView('::modules/privacy-policy/page', $this->name() . '::privacy-policy');
73
+
74
+		if ((int) $this->getPreference('MAJ_USE_LEGACY_XREF') === 1) {
75
+			Registry::xrefFactory(new LegacyXrefFactory());
76
+		}
77
+	}
78
+
79
+	/**
80
+	 * {@inheritDoc}
81
+	 * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes()
82
+	 */
83
+	public function loadRoutes(Map $router): void
84
+	{
85
+		$router->attach('', '', static function (Map $router): void {
86
+
87
+			$router->attach('', '/module-maj/misc', static function (Map $router): void {
88
+
89
+				$router->attach('', '/config/admin', static function (Map $router): void {
90
+
91
+					$router->get(AdminConfigPage::class, '', AdminConfigPage::class);
92
+					$router->post(AdminConfigAction::class, '', AdminConfigAction::class);
93
+				});
94
+			});
95
+		});
96
+	}
97
+
98
+	/**
99
+	 * {@inheritDoc}
100
+	 * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion()
101
+	 */
102
+	public function customModuleVersion(): string
103
+	{
104
+		return '2.1.15-v.1';
105
+	}
106
+
107
+	/**
108
+	 * {@inheritDoc}
109
+	 * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink()
110
+	 */
111
+	public function getConfigLink(): string
112
+	{
113
+		return route(AdminConfigPage::class);
114
+	}
115
+
116
+	/**
117
+	 * {@inheritDoc}
118
+	 * @see \MyArtJaub\Webtrees\Contracts\Hooks\ModuleHookSubscriberInterface::listSubscribedHooks()
119
+	 */
120
+	public function listSubscribedHooks(): array
121
+	{
122
+		return [
123
+			app()->makeWith(TitlesCardHook::class, [ 'module' => $this ])
124
+		];
125
+	}
126 126
 }
Please login to merge, or discard this patch.
app/Module/PatronymicLineage/Http/RequestHandlers/SurnamesList.php 1 patch
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -30,70 +30,70 @@
 block discarded – undo
30 30
  */
31 31
 class SurnamesList implements RequestHandlerInterface
32 32
 {
33
-    use ViewResponseTrait;
33
+	use ViewResponseTrait;
34 34
 
35
-    private ?PatronymicLineageModule $module;
35
+	private ?PatronymicLineageModule $module;
36 36
 
37
-    /**
38
-     * Constructor for SurnamesList Request Handler
39
-     *
40
-     * @param ModuleService $module_service
41
-     */
42
-    public function __construct(ModuleService $module_service)
43
-    {
44
-        $this->module = $module_service->findByInterface(PatronymicLineageModule::class)->first();
45
-    }
37
+	/**
38
+	 * Constructor for SurnamesList Request Handler
39
+	 *
40
+	 * @param ModuleService $module_service
41
+	 */
42
+	public function __construct(ModuleService $module_service)
43
+	{
44
+		$this->module = $module_service->findByInterface(PatronymicLineageModule::class)->first();
45
+	}
46 46
 
47
-    /**
48
-     * {@inheritDoc}
49
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
50
-     */
51
-    public function handle(ServerRequestInterface $request): ResponseInterface
52
-    {
53
-        if ($this->module === null) {
54
-            throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
55
-        }
47
+	/**
48
+	 * {@inheritDoc}
49
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
50
+	 */
51
+	public function handle(ServerRequestInterface $request): ResponseInterface
52
+	{
53
+		if ($this->module === null) {
54
+			throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
55
+		}
56 56
 
57
-        $tree = Validator::attributes($request)->tree();
58
-        $initial = Validator::attributes($request)->string('alpha', '');
57
+		$tree = Validator::attributes($request)->tree();
58
+		$initial = Validator::attributes($request)->string('alpha', '');
59 59
 
60
-        $surname_data     = $this->module->surnameData($tree, false, false);
61
-        $all_surnames     = $this->module->allSurnames($surname_data);
62
-        $initials_list = array_filter(
63
-            $this->module->surnameInitials($surname_data),
64
-            static fn (string $x): bool => $x !== '@' && $x !== ',',
65
-            ARRAY_FILTER_USE_KEY
66
-        );
60
+		$surname_data     = $this->module->surnameData($tree, false, false);
61
+		$all_surnames     = $this->module->allSurnames($surname_data);
62
+		$initials_list = array_filter(
63
+			$this->module->surnameInitials($surname_data),
64
+			static fn (string $x): bool => $x !== '@' && $x !== ',',
65
+			ARRAY_FILTER_USE_KEY
66
+		);
67 67
 
68
-        $show_all = Validator::queryParams($request)->string('show_all', 'no') === 'yes';
68
+		$show_all = Validator::queryParams($request)->string('show_all', 'no') === 'yes';
69 69
 
70
-        if ($show_all) {
71
-            $title = I18N::translate('Patronymic Lineages') . ' — ' . I18N::translate('All');
72
-            $surnames = array_filter(
73
-                $all_surnames,
74
-                static fn (string $x): bool => $x !== '' && $x !== Individual::NOMEN_NESCIO,
75
-                ARRAY_FILTER_USE_KEY
76
-            );
77
-        } elseif (array_key_exists($initial, $initials_list)) {
78
-            $title = I18N::translate('Patronymic Lineages') . ' — ' . $initial;
79
-            $surnames = array_filter(
80
-                $all_surnames,
81
-                static fn (string $x): bool => I18N::language()->initialLetter($x) === $initial,
82
-                ARRAY_FILTER_USE_KEY
83
-            );
84
-        } else {
85
-            $title =  I18N::translate('Patronymic Lineages');
86
-            $surnames = [];
87
-        }
70
+		if ($show_all) {
71
+			$title = I18N::translate('Patronymic Lineages') . ' — ' . I18N::translate('All');
72
+			$surnames = array_filter(
73
+				$all_surnames,
74
+				static fn (string $x): bool => $x !== '' && $x !== Individual::NOMEN_NESCIO,
75
+				ARRAY_FILTER_USE_KEY
76
+			);
77
+		} elseif (array_key_exists($initial, $initials_list)) {
78
+			$title = I18N::translate('Patronymic Lineages') . ' — ' . $initial;
79
+			$surnames = array_filter(
80
+				$all_surnames,
81
+				static fn (string $x): bool => I18N::language()->initialLetter($x) === $initial,
82
+				ARRAY_FILTER_USE_KEY
83
+			);
84
+		} else {
85
+			$title =  I18N::translate('Patronymic Lineages');
86
+			$surnames = [];
87
+		}
88 88
 
89
-        return $this->viewResponse($this->module->name() . '::surnames-page', [
90
-            'title'         =>  $title,
91
-            'module'        =>  $this->module,
92
-            'tree'          =>  $tree,
93
-            'initials_list' =>  $initials_list,
94
-            'initial'       =>  $initial,
95
-            'show_all'      =>  $show_all ? 'yes' : 'no',
96
-            'surnames'      =>  $surnames
97
-        ]);
98
-    }
89
+		return $this->viewResponse($this->module->name() . '::surnames-page', [
90
+			'title'         =>  $title,
91
+			'module'        =>  $this->module,
92
+			'tree'          =>  $tree,
93
+			'initials_list' =>  $initials_list,
94
+			'initial'       =>  $initial,
95
+			'show_all'      =>  $show_all ? 'yes' : 'no',
96
+			'surnames'      =>  $surnames
97
+		]);
98
+	}
99 99
 }
Please login to merge, or discard this patch.
app/Module/PatronymicLineage/Http/RequestHandlers/LineagesPage.php 1 patch
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -32,75 +32,75 @@
 block discarded – undo
32 32
  */
33 33
 class LineagesPage implements RequestHandlerInterface
34 34
 {
35
-    use ViewResponseTrait;
36
-
37
-    /**
38
-     * @var PatronymicLineageModule|null $module
39
-     */
40
-    private $module;
41
-
42
-    /**
43
-     * Constructor for LineagesPage Request handler
44
-     *
45
-     * @param ModuleService $module_service
46
-     */
47
-    public function __construct(ModuleService $module_service)
48
-    {
49
-        $this->module = $module_service->findByInterface(PatronymicLineageModule::class)->first();
50
-    }
51
-
52
-    /**
53
-     * {@inheritDoc}
54
-     * @see \Psr\Http\Server\RequestHandlerInterface::handle()
55
-     */
56
-    public function handle(ServerRequestInterface $request): ResponseInterface
57
-    {
58
-        if ($this->module === null) {
59
-            throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
60
-        }
61
-
62
-        $tree = Validator::attributes($request)->tree();
63
-        $surname_attr = Validator::attributes($request)->string('surname', '');
64
-        $surname = I18N::strtoupper(I18N::language()->normalize($surname_attr));
65
-
66
-        if ($surname_attr !== $surname) {
67
-            return Registry::responseFactory()
68
-                ->redirect(LineagesPage::class, ['tree' => $tree->name(), 'surname' => $surname]);
69
-        }
70
-
71
-        if ($surname === '' ||  $surname === Individual::NOMEN_NESCIO) {
72
-            return Registry::responseFactory()->redirect(SurnamesList::class, ['tree' => $tree->name()]);
73
-        }
74
-
75
-        $surn_initial = I18N::language()->initialLetter($surname);
76
-
77
-        $surname_data     = $this->module->surnameData($tree, false, false);
78
-        $all_surnames     = $this->module->allSurnames($surname_data);
79
-        $initials_list = array_filter(
80
-            $this->module->surnameInitials($surname_data),
81
-            static fn (string $x): bool => $x !== '@' && $x !== ',',
82
-            ARRAY_FILTER_USE_KEY
83
-        );
84
-
85
-        $surname_variants = array_keys($all_surnames[$surname] ?? [$surname => $surname]);
86
-        uasort($surname_variants, I18N::comparator());
87
-        $surname_legend = implode('/', $surname_variants);
88
-
89
-        $title = I18N::translate('Patronymic Lineages') . ' — ' . $surname_legend;
90
-
91
-        $lineages = app()->make(LineageBuilder::class, ['surname' => $surname])->buildLineages();
92
-
93
-        return $this->viewResponse($this->module->name() . '::lineages-page', [
94
-            'title'         =>  $title,
95
-            'module'        =>  $this->module,
96
-            'tree'          =>  $tree,
97
-            'initials_list' =>  $initials_list,
98
-            'initial'       =>  $surn_initial,
99
-            'show_all'      =>  'no',
100
-            'surname'       =>  $surname,
101
-            'surname_legend' =>  $surname_legend,
102
-            'lineages'      =>  $lineages,
103
-            'nb_lineages'   =>  $lineages !== null ? $lineages->count() : 0
104
-        ]);
105
-    }
35
+	use ViewResponseTrait;
36
+
37
+	/**
38
+	 * @var PatronymicLineageModule|null $module
39
+	 */
40
+	private $module;
41
+
42
+	/**
43
+	 * Constructor for LineagesPage Request handler
44
+	 *
45
+	 * @param ModuleService $module_service
46
+	 */
47
+	public function __construct(ModuleService $module_service)
48
+	{
49
+		$this->module = $module_service->findByInterface(PatronymicLineageModule::class)->first();
50
+	}
51
+
52
+	/**
53
+	 * {@inheritDoc}
54
+	 * @see \Psr\Http\Server\RequestHandlerInterface::handle()
55
+	 */
56
+	public function handle(ServerRequestInterface $request): ResponseInterface
57
+	{
58
+		if ($this->module === null) {
59
+			throw new HttpNotFoundException(I18N::translate('The attached module could not be found.'));
60
+		}
61
+
62
+		$tree = Validator::attributes($request)->tree();
63
+		$surname_attr = Validator::attributes($request)->string('surname', '');
64
+		$surname = I18N::strtoupper(I18N::language()->normalize($surname_attr));
65
+
66
+		if ($surname_attr !== $surname) {
67
+			return Registry::responseFactory()
68
+				->redirect(LineagesPage::class, ['tree' => $tree->name(), 'surname' => $surname]);
69
+		}
70
+
71
+		if ($surname === '' ||  $surname === Individual::NOMEN_NESCIO) {
72
+			return Registry::responseFactory()->redirect(SurnamesList::class, ['tree' => $tree->name()]);
73
+		}
74
+
75
+		$surn_initial = I18N::language()->initialLetter($surname);
76
+
77
+		$surname_data     = $this->module->surnameData($tree, false, false);
78
+		$all_surnames     = $this->module->allSurnames($surname_data);
79
+		$initials_list = array_filter(
80
+			$this->module->surnameInitials($surname_data),
81
+			static fn (string $x): bool => $x !== '@' && $x !== ',',
82
+			ARRAY_FILTER_USE_KEY
83
+		);
84
+
85
+		$surname_variants = array_keys($all_surnames[$surname] ?? [$surname => $surname]);
86
+		uasort($surname_variants, I18N::comparator());
87
+		$surname_legend = implode('/', $surname_variants);
88
+
89
+		$title = I18N::translate('Patronymic Lineages') . ' — ' . $surname_legend;
90
+
91
+		$lineages = app()->make(LineageBuilder::class, ['surname' => $surname])->buildLineages();
92
+
93
+		return $this->viewResponse($this->module->name() . '::lineages-page', [
94
+			'title'         =>  $title,
95
+			'module'        =>  $this->module,
96
+			'tree'          =>  $tree,
97
+			'initials_list' =>  $initials_list,
98
+			'initial'       =>  $surn_initial,
99
+			'show_all'      =>  'no',
100
+			'surname'       =>  $surname,
101
+			'surname_legend' =>  $surname_legend,
102
+			'lineages'      =>  $lineages,
103
+			'nb_lineages'   =>  $lineages !== null ? $lineages->count() : 0
104
+		]);
105
+	}
106 106
 }
Please login to merge, or discard this patch.
app/Module/PatronymicLineage/PatronymicLineageModule.php 1 patch
Indentation   +172 added lines, -172 removed lines patch added patch discarded remove patch
@@ -39,177 +39,177 @@
 block discarded – undo
39 39
  * Display lineages of people with the same surname.
40 40
  */
41 41
 class PatronymicLineageModule extends IndividualListModule implements
42
-    ModuleMyArtJaubInterface,
43
-    ModuleListInterface,
44
-    ModuleGlobalInterface
42
+	ModuleMyArtJaubInterface,
43
+	ModuleListInterface,
44
+	ModuleGlobalInterface
45 45
 {
46
-    use ModuleMyArtJaubTrait;
47
-    use ModuleListTrait;
48
-    use ModuleGlobalTrait;
49
-
50
-     /**
51
-     * {@inheritDoc}
52
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::title()
53
-     */
54
-    public function title(): string
55
-    {
56
-        return /* I18N: Name of the “Patronymic lineage” module */ I18N::translate('Patronymic Lineages');
57
-    }
58
-
59
-    /**
60
-     * {@inheritDoc}
61
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::description()
62
-     */
63
-    public function description(): string
64
-    {
65
-        //phpcs:ignore Generic.Files.LineLength.TooLong
66
-        return /* I18N: Description of the “Patronymic lineage” module */ I18N::translate('Display lineages of people holding the same surname.');
67
-    }
68
-
69
-    /**
70
-     * {@inheritDoc}
71
-     * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes()
72
-     */
73
-    public function loadRoutes(Map $router): void
74
-    {
75
-        $router->attach('', '', static function (Map $router): void {
76
-
77
-            $router->attach('', '/module-maj/lineages', static function (Map $router): void {
78
-
79
-                $router->attach('', '/Page', static function (Map $router): void {
80
-
81
-                    $router->get(SurnamesList::class, '/{tree}/list{/alpha}', SurnamesList::class);
82
-                    $router->get(LineagesPage::class, '/{tree}/lineage/{surname}', LineagesPage::class);
83
-                });
84
-            });
85
-        });
86
-    }
87
-
88
-    /**
89
-     * {@inheritDoc}
90
-     * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion()
91
-     */
92
-    public function customModuleVersion(): string
93
-    {
94
-        return '2.1.18-v.1';
95
-    }
96
-
97
-    /**
98
-     * {@inheritDoc}
99
-     * @see \Fisharebest\Webtrees\Module\ModuleListInterface::listUrl()
100
-     *
101
-     * @param array<bool|int|string|array<mixed>|null> $parameters
102
-     */
103
-    public function listUrl(Tree $tree, array $parameters = []): string
104
-    {
105
-        $surname = $parameters['surname'] ?? null;
106
-        $surname = is_string($surname) ? $surname : null;
107
-
108
-        $request = app(ServerRequestInterface::class);
109
-
110
-        // If a surname is already in the query attribute, use it
111
-        if ($surname === null) {
112
-            $surname_attr =  Validator::attributes($request)->string('surname', '');
113
-            $surname_param =  Validator::queryParams($request)->string('surname', '');
114
-            $surname_body =  Validator::parsedBody($request)->string('surname', '');
115
-            $surname = $surname_attr !== '' ? $surname_attr : (
116
-                $surname_param !== '' ? $surname_param : (
117
-                $surname_body !== '' ? $surname_body : null
118
-            ));
119
-        }
120
-
121
-        // If nothing found, and on an individual page, use its name
122
-        $xref = Validator::attributes($request)->isXref()->string('xref', '');
123
-        if ($xref !== '') {
124
-            $individual = Registry::individualFactory()->make($xref, $tree);
125
-            if ($individual instanceof Individual && $individual->canShow()) {
126
-                $primary_name = $individual->getPrimaryName();
127
-                $surname ??= $individual->getAllNames()[$primary_name]['surn'] ?? null;
128
-            }
129
-        }
130
-
131
-        if (Str::length($surname ?? '') > 0 && $surname !== Individual::NOMEN_NESCIO) {
132
-            return route(LineagesPage::class, [
133
-                'tree'      =>  $tree->name(),
134
-                'surname'   =>  $surname
135
-            ] + $parameters);
136
-        }
137
-        return route(SurnamesList::class, ['tree'  =>  $tree->name() ] + $parameters);
138
-    }
139
-
140
-    /**
141
-     * {@inheritDoc}
142
-     * @see \Fisharebest\Webtrees\Module\ModuleListInterface::listMenuClass()
143
-     */
144
-    public function listMenuClass(): string
145
-    {
146
-        return 'menu-maj-patrolineage';
147
-    }
148
-
149
-    /**
150
-     * {@inheritDoc}
151
-     * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::headContent()
152
-     */
153
-    public function headContent(): string
154
-    {
155
-        return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">';
156
-    }
157
-
158
-    /**
159
-     * {@inheritDoc}
160
-     * @see \Fisharebest\Webtrees\Module\IndividualListModule::individuals()
161
-     *
162
-     * Implemented to set the visibility to public.
163
-     * This should probably be in a service, but this hack allows for reuse of mainstream code.
164
-     */
165
-    public function individuals(
166
-        Tree $tree,
167
-        array $surns_to_show,
168
-        string $galpha,
169
-        bool $marnm,
170
-        bool $fams
171
-    ): Collection {
172
-        return parent::individuals($tree, $surns_to_show, $galpha, $marnm, $fams);
173
-    }
174
-
175
-    /**
176
-     * {@inheritDoc}
177
-     * @see \Fisharebest\Webtrees\Module\IndividualListModule::surnameData()
178
-     *
179
-     * Implemented to set the visibility to public.
180
-     * This should probably be in a service, but this hack allows for reuse of mainstream code.
181
-     *
182
-     * @return array<object{n_surn:string,n_surname:string,total:int}>
183
-     */
184
-    public function surnameData(Tree $tree, bool $marnm, bool $fams): array
185
-    {
186
-        $reflectionMethod = new ReflectionMethod(IndividualListModule::class, 'surnameData');
187
-        $reflectionMethod->setAccessible(true);
188
-
189
-        return $reflectionMethod->invoke($this, $tree, $marnm, $fams);
190
-    }
191
-
192
-    /**
193
-     * {@inheritDoc}
194
-     * @see \Fisharebest\Webtrees\Module\IndividualListModule::allSurnames()
195
-     *
196
-     * Implemented to set the visibility to public.
197
-     * This should probably be in a service, but this hack allows for reuse of mainstream code.
198
-     */
199
-    public function allSurnames(array $surname_data): array
200
-    {
201
-        return parent::allSurnames($surname_data);
202
-    }
203
-
204
-    /**
205
-     * {@inheritDoc}
206
-     * @see \Fisharebest\Webtrees\Module\IndividualListModule::surnameInitials()
207
-     *
208
-     * Implemented to set the visibility to public.
209
-     * This should probably be in a service, but this hack allows for reuse of mainstream code.
210
-     */
211
-    public function surnameInitials(array $surname_data): array
212
-    {
213
-        return parent::surnameInitials($surname_data);
214
-    }
46
+	use ModuleMyArtJaubTrait;
47
+	use ModuleListTrait;
48
+	use ModuleGlobalTrait;
49
+
50
+	 /**
51
+	  * {@inheritDoc}
52
+	  * @see \Fisharebest\Webtrees\Module\AbstractModule::title()
53
+	  */
54
+	public function title(): string
55
+	{
56
+		return /* I18N: Name of the “Patronymic lineage” module */ I18N::translate('Patronymic Lineages');
57
+	}
58
+
59
+	/**
60
+	 * {@inheritDoc}
61
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::description()
62
+	 */
63
+	public function description(): string
64
+	{
65
+		//phpcs:ignore Generic.Files.LineLength.TooLong
66
+		return /* I18N: Description of the “Patronymic lineage” module */ I18N::translate('Display lineages of people holding the same surname.');
67
+	}
68
+
69
+	/**
70
+	 * {@inheritDoc}
71
+	 * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes()
72
+	 */
73
+	public function loadRoutes(Map $router): void
74
+	{
75
+		$router->attach('', '', static function (Map $router): void {
76
+
77
+			$router->attach('', '/module-maj/lineages', static function (Map $router): void {
78
+
79
+				$router->attach('', '/Page', static function (Map $router): void {
80
+
81
+					$router->get(SurnamesList::class, '/{tree}/list{/alpha}', SurnamesList::class);
82
+					$router->get(LineagesPage::class, '/{tree}/lineage/{surname}', LineagesPage::class);
83
+				});
84
+			});
85
+		});
86
+	}
87
+
88
+	/**
89
+	 * {@inheritDoc}
90
+	 * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion()
91
+	 */
92
+	public function customModuleVersion(): string
93
+	{
94
+		return '2.1.18-v.1';
95
+	}
96
+
97
+	/**
98
+	 * {@inheritDoc}
99
+	 * @see \Fisharebest\Webtrees\Module\ModuleListInterface::listUrl()
100
+	 *
101
+	 * @param array<bool|int|string|array<mixed>|null> $parameters
102
+	 */
103
+	public function listUrl(Tree $tree, array $parameters = []): string
104
+	{
105
+		$surname = $parameters['surname'] ?? null;
106
+		$surname = is_string($surname) ? $surname : null;
107
+
108
+		$request = app(ServerRequestInterface::class);
109
+
110
+		// If a surname is already in the query attribute, use it
111
+		if ($surname === null) {
112
+			$surname_attr =  Validator::attributes($request)->string('surname', '');
113
+			$surname_param =  Validator::queryParams($request)->string('surname', '');
114
+			$surname_body =  Validator::parsedBody($request)->string('surname', '');
115
+			$surname = $surname_attr !== '' ? $surname_attr : (
116
+				$surname_param !== '' ? $surname_param : (
117
+				$surname_body !== '' ? $surname_body : null
118
+			));
119
+		}
120
+
121
+		// If nothing found, and on an individual page, use its name
122
+		$xref = Validator::attributes($request)->isXref()->string('xref', '');
123
+		if ($xref !== '') {
124
+			$individual = Registry::individualFactory()->make($xref, $tree);
125
+			if ($individual instanceof Individual && $individual->canShow()) {
126
+				$primary_name = $individual->getPrimaryName();
127
+				$surname ??= $individual->getAllNames()[$primary_name]['surn'] ?? null;
128
+			}
129
+		}
130
+
131
+		if (Str::length($surname ?? '') > 0 && $surname !== Individual::NOMEN_NESCIO) {
132
+			return route(LineagesPage::class, [
133
+				'tree'      =>  $tree->name(),
134
+				'surname'   =>  $surname
135
+			] + $parameters);
136
+		}
137
+		return route(SurnamesList::class, ['tree'  =>  $tree->name() ] + $parameters);
138
+	}
139
+
140
+	/**
141
+	 * {@inheritDoc}
142
+	 * @see \Fisharebest\Webtrees\Module\ModuleListInterface::listMenuClass()
143
+	 */
144
+	public function listMenuClass(): string
145
+	{
146
+		return 'menu-maj-patrolineage';
147
+	}
148
+
149
+	/**
150
+	 * {@inheritDoc}
151
+	 * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::headContent()
152
+	 */
153
+	public function headContent(): string
154
+	{
155
+		return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">';
156
+	}
157
+
158
+	/**
159
+	 * {@inheritDoc}
160
+	 * @see \Fisharebest\Webtrees\Module\IndividualListModule::individuals()
161
+	 *
162
+	 * Implemented to set the visibility to public.
163
+	 * This should probably be in a service, but this hack allows for reuse of mainstream code.
164
+	 */
165
+	public function individuals(
166
+		Tree $tree,
167
+		array $surns_to_show,
168
+		string $galpha,
169
+		bool $marnm,
170
+		bool $fams
171
+	): Collection {
172
+		return parent::individuals($tree, $surns_to_show, $galpha, $marnm, $fams);
173
+	}
174
+
175
+	/**
176
+	 * {@inheritDoc}
177
+	 * @see \Fisharebest\Webtrees\Module\IndividualListModule::surnameData()
178
+	 *
179
+	 * Implemented to set the visibility to public.
180
+	 * This should probably be in a service, but this hack allows for reuse of mainstream code.
181
+	 *
182
+	 * @return array<object{n_surn:string,n_surname:string,total:int}>
183
+	 */
184
+	public function surnameData(Tree $tree, bool $marnm, bool $fams): array
185
+	{
186
+		$reflectionMethod = new ReflectionMethod(IndividualListModule::class, 'surnameData');
187
+		$reflectionMethod->setAccessible(true);
188
+
189
+		return $reflectionMethod->invoke($this, $tree, $marnm, $fams);
190
+	}
191
+
192
+	/**
193
+	 * {@inheritDoc}
194
+	 * @see \Fisharebest\Webtrees\Module\IndividualListModule::allSurnames()
195
+	 *
196
+	 * Implemented to set the visibility to public.
197
+	 * This should probably be in a service, but this hack allows for reuse of mainstream code.
198
+	 */
199
+	public function allSurnames(array $surname_data): array
200
+	{
201
+		return parent::allSurnames($surname_data);
202
+	}
203
+
204
+	/**
205
+	 * {@inheritDoc}
206
+	 * @see \Fisharebest\Webtrees\Module\IndividualListModule::surnameInitials()
207
+	 *
208
+	 * Implemented to set the visibility to public.
209
+	 * This should probably be in a service, but this hack allows for reuse of mainstream code.
210
+	 */
211
+	public function surnameInitials(array $surname_data): array
212
+	{
213
+		return parent::surnameInitials($surname_data);
214
+	}
215 215
 }
Please login to merge, or discard this patch.