1 | <?php |
||
2 | |||
3 | /** |
||
4 | * webtrees: online genealogy |
||
5 | * Copyright (C) 2025 webtrees development team |
||
6 | * This program is free software: you can redistribute it and/or modify |
||
7 | * it under the terms of the GNU General Public License as published by |
||
8 | * the Free Software Foundation, either version 3 of the License, or |
||
9 | * (at your option) any later version. |
||
10 | * This program is distributed in the hope that it will be useful, |
||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
13 | * GNU General Public License for more details. |
||
14 | * You should have received a copy of the GNU General Public License |
||
15 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
||
16 | */ |
||
17 | |||
18 | declare(strict_types=1); |
||
19 | |||
20 | namespace Fisharebest\Webtrees\Http\RequestHandlers; |
||
21 | |||
22 | use Fisharebest\Webtrees\Auth; |
||
0 ignored issues
–
show
|
|||
23 | use Fisharebest\Webtrees\Http\ViewResponseTrait; |
||
24 | use Fisharebest\Webtrees\Module\ModuleInterface; |
||
25 | use Fisharebest\Webtrees\Services\ModuleService; |
||
0 ignored issues
–
show
The type
Fisharebest\Webtrees\Services\ModuleService was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
26 | use Fisharebest\Webtrees\Services\TreeService; |
||
0 ignored issues
–
show
The type
Fisharebest\Webtrees\Services\TreeService was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
27 | use Fisharebest\Webtrees\Tree; |
||
28 | use Psr\Http\Message\ResponseInterface; |
||
29 | use Psr\Http\Server\RequestHandlerInterface; |
||
30 | |||
31 | /** |
||
32 | * Show a list of modules. |
||
33 | */ |
||
34 | abstract class AbstractModuleComponentPage implements RequestHandlerInterface |
||
35 | { |
||
36 | use ViewResponseTrait; |
||
37 | |||
38 | private ModuleService $module_service; |
||
39 | |||
40 | private TreeService $tree_service; |
||
41 | |||
42 | /** |
||
43 | * @param ModuleService $module_service |
||
44 | * @param TreeService $tree_service |
||
45 | */ |
||
46 | public function __construct(ModuleService $module_service, TreeService $tree_service) |
||
47 | { |
||
48 | $this->module_service = $module_service; |
||
49 | $this->tree_service = $tree_service; |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * @template T of ModuleInterface |
||
54 | * |
||
55 | * @param class-string<T> $interface |
||
56 | * @param string $title |
||
57 | * @param string $description |
||
58 | * |
||
59 | * @return ResponseInterface |
||
60 | */ |
||
61 | protected function listComponents(string $interface, string $title, string $description): ResponseInterface |
||
62 | { |
||
63 | $this->layout = 'layouts/administration'; |
||
64 | |||
65 | $modules = $this->module_service->findByInterface($interface, true, true); |
||
66 | $uses_access = $this->module_service->componentsWithAccess()->containsStrict($interface); |
||
67 | $uses_sorting = $this->module_service->componentsWithOrder()->containsStrict($interface); |
||
68 | |||
69 | $access_summary = $modules |
||
70 | ->mapWithKeys(function (ModuleInterface $module) use ($interface): array { |
||
71 | $access_levels = $this->tree_service->all() |
||
72 | ->map(static fn (Tree $tree): int => $module->accessLevel($tree, $interface)) |
||
73 | ->uniqueStrict() |
||
74 | ->values() |
||
75 | ->map(static fn (int $level): string => Auth::accessLevelNames()[$level]) |
||
76 | ->all(); |
||
77 | |||
78 | return [$module->name() => $access_levels]; |
||
79 | }) |
||
80 | ->all(); |
||
81 | |||
82 | return $this->viewResponse('admin/components', [ |
||
83 | 'description' => $description, |
||
84 | 'interface' => $interface, |
||
85 | 'modules' => $modules, |
||
86 | 'title' => $title, |
||
87 | 'trees' => $this->tree_service->all(), |
||
88 | 'uses_access' => $uses_access, |
||
89 | 'uses_sorting' => $uses_sorting, |
||
90 | 'access_summary' => $access_summary, |
||
91 | ]); |
||
92 | } |
||
93 | } |
||
94 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths