Passed
Push — feature/code-analysis ( a2ce2d...28b704 )
by Jonathan
04:31
created
app/Module/Hooks/Hooks/SosaMissingDatatablesExtenderCollector.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -25,45 +25,45 @@
 block discarded – undo
25 25
  * @extends AbstractHookCollector<SosaMissingDatatablesExtenderInterface>
26 26
  */
27 27
 class SosaMissingDatatablesExtenderCollector extends AbstractHookCollector implements
28
-    SosaMissingDatatablesExtenderInterface
28
+	SosaMissingDatatablesExtenderInterface
29 29
 {
30
-    /**
31
-     * {@inheritDoc}
32
-     * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::title()
33
-     */
34
-    public function title(): string
35
-    {
36
-        return I18N::translate('Columns extender for tables of missing ancestors');
37
-    }
30
+	/**
31
+	 * {@inheritDoc}
32
+	 * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::title()
33
+	 */
34
+	public function title(): string
35
+	{
36
+		return I18N::translate('Columns extender for tables of missing ancestors');
37
+	}
38 38
 
39
-    /**
40
-     * {@inheritDoc}
41
-     * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::description()
42
-     */
43
-    public function description(): string
44
-    {
45
-        return I18N::translate('Add additional columns to tables of missing ancestors');
46
-    }
39
+	/**
40
+	 * {@inheritDoc}
41
+	 * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::description()
42
+	 */
43
+	public function description(): string
44
+	{
45
+		return I18N::translate('Add additional columns to tables of missing ancestors');
46
+	}
47 47
 
48
-    /**
49
-     * {@inheritDoc}
50
-     * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::hookInterface()
51
-     */
52
-    public function hookInterface(): string
53
-    {
54
-        return SosaMissingDatatablesExtenderInterface::class;
55
-    }
48
+	/**
49
+	 * {@inheritDoc}
50
+	 * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::hookInterface()
51
+	 */
52
+	public function hookInterface(): string
53
+	{
54
+		return SosaMissingDatatablesExtenderInterface::class;
55
+	}
56 56
 
57
-    /**
58
-     * {@inheritDoc}
59
-     * @see \MyArtJaub\Webtrees\Contracts\Hooks\SosaMissingDatatablesExtenderInterface::sosaMissingColumns()
60
-     */
61
-    public function sosaMissingColumns(iterable $records): array
62
-    {
63
-        $result = [];
64
-        foreach ($this->hooks() as $hook) {
65
-            $result += $hook->sosaMissingColumns($records);
66
-        }
67
-        return $result;
68
-    }
57
+	/**
58
+	 * {@inheritDoc}
59
+	 * @see \MyArtJaub\Webtrees\Contracts\Hooks\SosaMissingDatatablesExtenderInterface::sosaMissingColumns()
60
+	 */
61
+	public function sosaMissingColumns(iterable $records): array
62
+	{
63
+		$result = [];
64
+		foreach ($this->hooks() as $hook) {
65
+			$result += $hook->sosaMissingColumns($records);
66
+		}
67
+		return $result;
68
+	}
69 69
 }
Please login to merge, or discard this patch.
app/Module/Hooks/Hooks/SosaFamilyDatatablesExtenderCollector.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -25,45 +25,45 @@
 block discarded – undo
25 25
  * @extends AbstractHookCollector<SosaFamilyDatatablesExtenderInterface>
26 26
  */
27 27
 class SosaFamilyDatatablesExtenderCollector extends AbstractHookCollector implements
28
-    SosaFamilyDatatablesExtenderInterface
28
+	SosaFamilyDatatablesExtenderInterface
29 29
 {
30
-    /**
31
-     * {@inheritDoc}
32
-     * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::title()
33
-     */
34
-    public function title(): string
35
-    {
36
-        return I18N::translate('Columns extender for tables of ancestors’ families');
37
-    }
30
+	/**
31
+	 * {@inheritDoc}
32
+	 * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::title()
33
+	 */
34
+	public function title(): string
35
+	{
36
+		return I18N::translate('Columns extender for tables of ancestors’ families');
37
+	}
38 38
 
39
-    /**
40
-     * {@inheritDoc}
41
-     * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::description()
42
-     */
43
-    public function description(): string
44
-    {
45
-        return I18N::translate('Add additional columns to tables of ancestors’ families');
46
-    }
39
+	/**
40
+	 * {@inheritDoc}
41
+	 * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::description()
42
+	 */
43
+	public function description(): string
44
+	{
45
+		return I18N::translate('Add additional columns to tables of ancestors’ families');
46
+	}
47 47
 
48
-    /**
49
-     * {@inheritDoc}
50
-     * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::hookInterface()
51
-     */
52
-    public function hookInterface(): string
53
-    {
54
-        return SosaFamilyDatatablesExtenderInterface::class;
55
-    }
48
+	/**
49
+	 * {@inheritDoc}
50
+	 * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::hookInterface()
51
+	 */
52
+	public function hookInterface(): string
53
+	{
54
+		return SosaFamilyDatatablesExtenderInterface::class;
55
+	}
56 56
 
57
-    /**
58
-     * {@inheritDoc}
59
-     * @see \MyArtJaub\Webtrees\Contracts\Hooks\SosaFamilyDatatablesExtenderInterface::sosaFamilyColumns()
60
-     */
61
-    public function sosaFamilyColumns(iterable $records): array
62
-    {
63
-        $result = [];
64
-        foreach ($this->hooks() as $hook) {
65
-            $result += $hook->sosaFamilyColumns($records);
66
-        }
67
-        return $result;
68
-    }
57
+	/**
58
+	 * {@inheritDoc}
59
+	 * @see \MyArtJaub\Webtrees\Contracts\Hooks\SosaFamilyDatatablesExtenderInterface::sosaFamilyColumns()
60
+	 */
61
+	public function sosaFamilyColumns(iterable $records): array
62
+	{
63
+		$result = [];
64
+		foreach ($this->hooks() as $hook) {
65
+			$result += $hook->sosaFamilyColumns($records);
66
+		}
67
+		return $result;
68
+	}
69 69
 }
Please login to merge, or discard this patch.
app/Module/Hooks/Hooks/SosaIndividualDatatablesExtenderCollector.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -25,45 +25,45 @@
 block discarded – undo
25 25
  * @extends AbstractHookCollector<SosaIndividualDatatablesExtenderInterface>
26 26
  */
27 27
 class SosaIndividualDatatablesExtenderCollector extends AbstractHookCollector implements
28
-    SosaIndividualDatatablesExtenderInterface
28
+	SosaIndividualDatatablesExtenderInterface
29 29
 {
30
-    /**
31
-     * {@inheritDoc}
32
-     * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::title()
33
-     */
34
-    public function title(): string
35
-    {
36
-        return I18N::translate('Columns extender for tables of ancestors');
37
-    }
30
+	/**
31
+	 * {@inheritDoc}
32
+	 * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::title()
33
+	 */
34
+	public function title(): string
35
+	{
36
+		return I18N::translate('Columns extender for tables of ancestors');
37
+	}
38 38
 
39
-    /**
40
-     * {@inheritDoc}
41
-     * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::description()
42
-     */
43
-    public function description(): string
44
-    {
45
-        return I18N::translate('Add additional columns to tables of ancestors');
46
-    }
39
+	/**
40
+	 * {@inheritDoc}
41
+	 * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::description()
42
+	 */
43
+	public function description(): string
44
+	{
45
+		return I18N::translate('Add additional columns to tables of ancestors');
46
+	}
47 47
 
48
-    /**
49
-     * {@inheritDoc}
50
-     * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::hookInterface()
51
-     */
52
-    public function hookInterface(): string
53
-    {
54
-        return SosaIndividualDatatablesExtenderInterface::class;
55
-    }
48
+	/**
49
+	 * {@inheritDoc}
50
+	 * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::hookInterface()
51
+	 */
52
+	public function hookInterface(): string
53
+	{
54
+		return SosaIndividualDatatablesExtenderInterface::class;
55
+	}
56 56
 
57
-    /**
58
-     * {@inheritDoc}
59
-     * @see \MyArtJaub\Webtrees\Contracts\Hooks\SosaIndividualDatatablesExtenderInterface::sosaIndividualColumns()
60
-     */
61
-    public function sosaIndividualColumns(iterable $records): array
62
-    {
63
-        $result = [];
64
-        foreach ($this->hooks() as $hook) {
65
-            $result += $hook->sosaIndividualColumns($records);
66
-        }
67
-        return $result;
68
-    }
57
+	/**
58
+	 * {@inheritDoc}
59
+	 * @see \MyArtJaub\Webtrees\Contracts\Hooks\SosaIndividualDatatablesExtenderInterface::sosaIndividualColumns()
60
+	 */
61
+	public function sosaIndividualColumns(iterable $records): array
62
+	{
63
+		$result = [];
64
+		foreach ($this->hooks() as $hook) {
65
+			$result += $hook->sosaIndividualColumns($records);
66
+		}
67
+		return $result;
68
+	}
69 69
 }
Please login to merge, or discard this patch.
app/Module/Hooks/Hooks/FactSourceTextExtenderCollector.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -27,56 +27,56 @@
 block discarded – undo
27 27
  */
28 28
 class FactSourceTextExtenderCollector extends AbstractHookCollector implements FactSourceTextExtenderInterface
29 29
 {
30
-    /**
31
-     * {@inheritDoc}
32
-     * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::title()
33
-     */
34
-    public function title(): string
35
-    {
36
-        return I18N::translate('Text extender for source citations’ title');
37
-    }
30
+	/**
31
+	 * {@inheritDoc}
32
+	 * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::title()
33
+	 */
34
+	public function title(): string
35
+	{
36
+		return I18N::translate('Text extender for source citations’ title');
37
+	}
38 38
 
39
-    /**
40
-     * {@inheritDoc}
41
-     * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::description()
42
-     */
43
-    public function description(): string
44
-    {
45
-        return I18N::translate('Extends the title of source citations with additional text or icons.');
46
-    }
39
+	/**
40
+	 * {@inheritDoc}
41
+	 * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::description()
42
+	 */
43
+	public function description(): string
44
+	{
45
+		return I18N::translate('Extends the title of source citations with additional text or icons.');
46
+	}
47 47
 
48
-    /**
49
-     * {@inheritDoc}
50
-     * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::hookInterface()
51
-     */
52
-    public function hookInterface(): string
53
-    {
54
-        return FactSourceTextExtenderInterface::class;
55
-    }
48
+	/**
49
+	 * {@inheritDoc}
50
+	 * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::hookInterface()
51
+	 */
52
+	public function hookInterface(): string
53
+	{
54
+		return FactSourceTextExtenderInterface::class;
55
+	}
56 56
 
57
-    /**
58
-     * {@inheritDoc}
59
-     * @see \MyArtJaub\Webtrees\Contracts\Hooks\FactSourceTextExtenderInterface::factSourcePrepend()
60
-     */
61
-    public function factSourcePrepend(Tree $tree, $fact): string
62
-    {
63
-        return $this->hooks()
64
-            ->map(
65
-                fn(FactSourceTextExtenderInterface $hook) =>
66
-                    $hook->factSourcePrepend($tree, $fact)
67
-            )->implode('');
68
-    }
57
+	/**
58
+	 * {@inheritDoc}
59
+	 * @see \MyArtJaub\Webtrees\Contracts\Hooks\FactSourceTextExtenderInterface::factSourcePrepend()
60
+	 */
61
+	public function factSourcePrepend(Tree $tree, $fact): string
62
+	{
63
+		return $this->hooks()
64
+			->map(
65
+				fn(FactSourceTextExtenderInterface $hook) =>
66
+					$hook->factSourcePrepend($tree, $fact)
67
+			)->implode('');
68
+	}
69 69
 
70
-    /**
71
-     * {@inheritDoc}
72
-     * @see \MyArtJaub\Webtrees\Contracts\Hooks\FactSourceTextExtenderInterface::factSourceAppend()
73
-     */
74
-    public function factSourceAppend(Tree $tree, $fact): string
75
-    {
76
-        return $this->hooks()
77
-            ->map(
78
-                fn(FactSourceTextExtenderInterface $hook) =>
79
-                    $hook->factSourcePrepend($tree, $fact)
80
-            )->implode('');
81
-    }
70
+	/**
71
+	 * {@inheritDoc}
72
+	 * @see \MyArtJaub\Webtrees\Contracts\Hooks\FactSourceTextExtenderInterface::factSourceAppend()
73
+	 */
74
+	public function factSourceAppend(Tree $tree, $fact): string
75
+	{
76
+		return $this->hooks()
77
+			->map(
78
+				fn(FactSourceTextExtenderInterface $hook) =>
79
+					$hook->factSourcePrepend($tree, $fact)
80
+			)->implode('');
81
+	}
82 82
 }
Please login to merge, or discard this patch.
app/Module/Hooks/Hooks/FamilyDatatablesExtenderCollector.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -25,45 +25,45 @@
 block discarded – undo
25 25
  * @extends AbstractHookCollector<FamilyDatatablesExtenderInterface>
26 26
  */
27 27
 class FamilyDatatablesExtenderCollector extends AbstractHookCollector implements
28
-    FamilyDatatablesExtenderInterface
28
+	FamilyDatatablesExtenderInterface
29 29
 {
30
-    /**
31
-     * {@inheritDoc}
32
-     * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::title()
33
-     */
34
-    public function title(): string
35
-    {
36
-        return I18N::translate('Columns extender for tables of families');
37
-    }
30
+	/**
31
+	 * {@inheritDoc}
32
+	 * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::title()
33
+	 */
34
+	public function title(): string
35
+	{
36
+		return I18N::translate('Columns extender for tables of families');
37
+	}
38 38
 
39
-    /**
40
-     * {@inheritDoc}
41
-     * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::description()
42
-     */
43
-    public function description(): string
44
-    {
45
-        return I18N::translate('Add additional columns to tables of families');
46
-    }
39
+	/**
40
+	 * {@inheritDoc}
41
+	 * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::description()
42
+	 */
43
+	public function description(): string
44
+	{
45
+		return I18N::translate('Add additional columns to tables of families');
46
+	}
47 47
 
48
-    /**
49
-     * {@inheritDoc}
50
-     * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::hookInterface()
51
-     */
52
-    public function hookInterface(): string
53
-    {
54
-        return FamilyDatatablesExtenderInterface::class;
55
-    }
48
+	/**
49
+	 * {@inheritDoc}
50
+	 * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::hookInterface()
51
+	 */
52
+	public function hookInterface(): string
53
+	{
54
+		return FamilyDatatablesExtenderInterface::class;
55
+	}
56 56
 
57
-    /**
58
-     * {@inheritDoc}
59
-     * @see \MyArtJaub\Webtrees\Contracts\Hooks\FamilyDatatablesExtenderInterface::familyColumns()
60
-     */
61
-    public function familyColumns(iterable $records): array
62
-    {
63
-        $result = [];
64
-        foreach ($this->hooks() as $hook) {
65
-            $result += $hook->familyColumns($records);
66
-        }
67
-        return $result;
68
-    }
57
+	/**
58
+	 * {@inheritDoc}
59
+	 * @see \MyArtJaub\Webtrees\Contracts\Hooks\FamilyDatatablesExtenderInterface::familyColumns()
60
+	 */
61
+	public function familyColumns(iterable $records): array
62
+	{
63
+		$result = [];
64
+		foreach ($this->hooks() as $hook) {
65
+			$result += $hook->familyColumns($records);
66
+		}
67
+		return $result;
68
+	}
69 69
 }
Please login to merge, or discard this patch.
app/Module/Hooks/Hooks/IndividualDatatablesExtenderCollector.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -25,45 +25,45 @@
 block discarded – undo
25 25
  * @extends AbstractHookCollector<IndividualDatatablesExtenderInterface>
26 26
  */
27 27
 class IndividualDatatablesExtenderCollector extends AbstractHookCollector implements
28
-    IndividualDatatablesExtenderInterface
28
+	IndividualDatatablesExtenderInterface
29 29
 {
30
-    /**
31
-     * {@inheritDoc}
32
-     * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::title()
33
-     */
34
-    public function title(): string
35
-    {
36
-        return I18N::translate('Columns extender for tables of individuals');
37
-    }
30
+	/**
31
+	 * {@inheritDoc}
32
+	 * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::title()
33
+	 */
34
+	public function title(): string
35
+	{
36
+		return I18N::translate('Columns extender for tables of individuals');
37
+	}
38 38
 
39
-    /**
40
-     * {@inheritDoc}
41
-     * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::description()
42
-     */
43
-    public function description(): string
44
-    {
45
-        return I18N::translate('Add additional columns to tables of individuals');
46
-    }
39
+	/**
40
+	 * {@inheritDoc}
41
+	 * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::description()
42
+	 */
43
+	public function description(): string
44
+	{
45
+		return I18N::translate('Add additional columns to tables of individuals');
46
+	}
47 47
 
48
-    /**
49
-     * {@inheritDoc}
50
-     * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::hookInterface()
51
-     */
52
-    public function hookInterface(): string
53
-    {
54
-        return IndividualDatatablesExtenderInterface::class;
55
-    }
48
+	/**
49
+	 * {@inheritDoc}
50
+	 * @see \MyArtJaub\Webtrees\Common\Hooks\AbstractHookCollector::hookInterface()
51
+	 */
52
+	public function hookInterface(): string
53
+	{
54
+		return IndividualDatatablesExtenderInterface::class;
55
+	}
56 56
 
57
-    /**
58
-     * {@inheritDoc}
59
-     * @see \MyArtJaub\Webtrees\Contracts\Hooks\IndividualDatatablesExtenderInterface::individualColumns()
60
-     */
61
-    public function individualColumns(iterable $records): array
62
-    {
63
-        $result = [];
64
-        foreach ($this->hooks() as $hook) {
65
-            $result += $hook->individualColumns($records);
66
-        }
67
-        return $result;
68
-    }
57
+	/**
58
+	 * {@inheritDoc}
59
+	 * @see \MyArtJaub\Webtrees\Contracts\Hooks\IndividualDatatablesExtenderInterface::individualColumns()
60
+	 */
61
+	public function individualColumns(iterable $records): array
62
+	{
63
+		$result = [];
64
+		foreach ($this->hooks() as $hook) {
65
+			$result += $hook->individualColumns($records);
66
+		}
67
+		return $result;
68
+	}
69 69
 }
Please login to merge, or discard this patch.
app/Module/Hooks/HooksModule.php 1 patch
Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -42,106 +42,106 @@
 block discarded – undo
42 42
  * Provide entry points to extend core webtrees code.
43 43
  */
44 44
 class HooksModule extends AbstractModule implements
45
-    ModuleMyArtJaubInterface,
46
-    ModuleConfigInterface,
47
-    ModuleHookSubscriberInterface
45
+	ModuleMyArtJaubInterface,
46
+	ModuleConfigInterface,
47
+	ModuleHookSubscriberInterface
48 48
 {
49
-    use ModuleMyArtJaubTrait {
50
-        boot as traitBoot;
51
-    }
52
-    use ModuleConfigTrait;
53
-
54
-    // How to update the database schema for this module
55
-    private const SCHEMA_TARGET_VERSION   = 2;
56
-    private const SCHEMA_SETTING_NAME     = 'MAJ_HOOKS_SCHEMA_VERSION';
57
-    private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema';
58
-
59
-    /**
60
-     * {@inheritDoc}
61
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::title()
62
-     */
63
-    public function title(): string
64
-    {
65
-        return /* I18N: Name of the “Hooks” module */ I18N::translate('Hooks');
66
-    }
67
-
68
-    /**
69
-     * {@inheritDoc}
70
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::description()
71
-     */
72
-    public function description(): string
73
-    {
74
-        return /* I18N: Description of the “Hooks” module */ I18N::translate('Implements hooks management.');
75
-    }
76
-
77
-    /**
78
-     * {@inheritDoc}
79
-     * @see \Fisharebest\Webtrees\Module\AbstractModule::boot()
80
-     */
81
-    public function boot(): void
82
-    {
83
-        $this->traitBoot();
84
-        app()->bind(HookServiceInterface::class, HookService::class);
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/hooks', static function (Map $router): void {
101
-
102
-                $router->attach('', '/config/admin', static function (Map $router): void {
103
-
104
-                    $router->get(AdminConfigPage::class, '', AdminConfigPage::class);
105
-                    $router->get(ModulesHooksPage::class, '/{hook_name}', ModulesHooksPage::class);
106
-                    $router->post(ModulesHooksAction::class, '/{hook_name}', ModulesHooksAction::class);
107
-                });
108
-            });
109
-        });
110
-    }
111
-
112
-    /**
113
-     * {@inheritDoc}
114
-     * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion()
115
-     */
116
-    public function customModuleVersion(): string
117
-    {
118
-        return '2.1.1-v.1';
119
-    }
120
-
121
-    /**
122
-     * {@inheritDoc}
123
-     * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink()
124
-     */
125
-    public function getConfigLink(): string
126
-    {
127
-        return route(AdminConfigPage::class);
128
-    }
129
-
130
-    /**
131
-     * {@inheritDoc}
132
-     * @see \MyArtJaub\Webtrees\Contracts\Hooks\ModuleHookSubscriberInterface::listSubscribedHooks()
133
-     */
134
-    public function listSubscribedHooks(): array
135
-    {
136
-        return [
137
-            app()->makeWith(FactSourceTextExtenderCollector::class, ['module' => $this]),
138
-            app()->makeWith(FamilyDatatablesExtenderCollector::class, ['module' => $this]),
139
-            app()->makeWith(IndividualDatatablesExtenderCollector::class, ['module' => $this]),
140
-            app()->makeWith(NameAccordionExtenderCollector::class, ['module' => $this]),
141
-            app()->makeWith(RecordNameTextExtenderCollector::class, ['module' => $this]),
142
-            app()->makeWith(SosaFamilyDatatablesExtenderCollector::class, ['module' => $this]),
143
-            app()->makeWith(SosaIndividualDatatablesExtenderCollector::class, ['module' => $this]),
144
-            app()->makeWith(SosaMissingDatatablesExtenderCollector::class, ['module' => $this])
145
-        ];
146
-    }
49
+	use ModuleMyArtJaubTrait {
50
+		boot as traitBoot;
51
+	}
52
+	use ModuleConfigTrait;
53
+
54
+	// How to update the database schema for this module
55
+	private const SCHEMA_TARGET_VERSION   = 2;
56
+	private const SCHEMA_SETTING_NAME     = 'MAJ_HOOKS_SCHEMA_VERSION';
57
+	private const SCHEMA_MIGRATION_PREFIX = __NAMESPACE__ . '\Schema';
58
+
59
+	/**
60
+	 * {@inheritDoc}
61
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::title()
62
+	 */
63
+	public function title(): string
64
+	{
65
+		return /* I18N: Name of the “Hooks” module */ I18N::translate('Hooks');
66
+	}
67
+
68
+	/**
69
+	 * {@inheritDoc}
70
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::description()
71
+	 */
72
+	public function description(): string
73
+	{
74
+		return /* I18N: Description of the “Hooks” module */ I18N::translate('Implements hooks management.');
75
+	}
76
+
77
+	/**
78
+	 * {@inheritDoc}
79
+	 * @see \Fisharebest\Webtrees\Module\AbstractModule::boot()
80
+	 */
81
+	public function boot(): void
82
+	{
83
+		$this->traitBoot();
84
+		app()->bind(HookServiceInterface::class, HookService::class);
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/hooks', static function (Map $router): void {
101
+
102
+				$router->attach('', '/config/admin', static function (Map $router): void {
103
+
104
+					$router->get(AdminConfigPage::class, '', AdminConfigPage::class);
105
+					$router->get(ModulesHooksPage::class, '/{hook_name}', ModulesHooksPage::class);
106
+					$router->post(ModulesHooksAction::class, '/{hook_name}', ModulesHooksAction::class);
107
+				});
108
+			});
109
+		});
110
+	}
111
+
112
+	/**
113
+	 * {@inheritDoc}
114
+	 * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion()
115
+	 */
116
+	public function customModuleVersion(): string
117
+	{
118
+		return '2.1.1-v.1';
119
+	}
120
+
121
+	/**
122
+	 * {@inheritDoc}
123
+	 * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink()
124
+	 */
125
+	public function getConfigLink(): string
126
+	{
127
+		return route(AdminConfigPage::class);
128
+	}
129
+
130
+	/**
131
+	 * {@inheritDoc}
132
+	 * @see \MyArtJaub\Webtrees\Contracts\Hooks\ModuleHookSubscriberInterface::listSubscribedHooks()
133
+	 */
134
+	public function listSubscribedHooks(): array
135
+	{
136
+		return [
137
+			app()->makeWith(FactSourceTextExtenderCollector::class, ['module' => $this]),
138
+			app()->makeWith(FamilyDatatablesExtenderCollector::class, ['module' => $this]),
139
+			app()->makeWith(IndividualDatatablesExtenderCollector::class, ['module' => $this]),
140
+			app()->makeWith(NameAccordionExtenderCollector::class, ['module' => $this]),
141
+			app()->makeWith(RecordNameTextExtenderCollector::class, ['module' => $this]),
142
+			app()->makeWith(SosaFamilyDatatablesExtenderCollector::class, ['module' => $this]),
143
+			app()->makeWith(SosaIndividualDatatablesExtenderCollector::class, ['module' => $this]),
144
+			app()->makeWith(SosaMissingDatatablesExtenderCollector::class, ['module' => $this])
145
+		];
146
+	}
147 147
 }
Please login to merge, or discard this patch.
app/Module/Hooks/Schema/Migration0.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@
 block discarded – undo
21 21
  */
22 22
 class Migration0 implements MigrationInterface
23 23
 {
24
-    /**
25
-     * {@inheritDoc}
26
-     * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade()
27
-     */
28
-    public function upgrade(): void
29
-    {
24
+	/**
25
+	 * {@inheritDoc}
26
+	 * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade()
27
+	 */
28
+	public function upgrade(): void
29
+	{
30 30
 
31
-        // This migration has been superseded by migration 1.
32
-    }
31
+		// This migration has been superseded by migration 1.
32
+	}
33 33
 }
Please login to merge, or discard this patch.
app/Module/Hooks/Schema/Migration1.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -23,28 +23,28 @@
 block discarded – undo
23 23
  */
24 24
 class Migration1 implements MigrationInterface
25 25
 {
26
-    /**
27
-     * {@inheritDoc}
28
-     * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade()
29
-     */
30
-    public function upgrade(): void
31
-    {
32
-        $in_transaction = DB::connection()->getPdo()->inTransaction();
33
-
34
-        if (DB::schema()->hasTable('maj_hooks')) {
35
-            DB::schema()->drop('maj_hooks');
36
-        }
37
-
38
-        DB::schema()->create('maj_hook_order', static function (Blueprint $table): void {
39
-            $table->string('majho_module_name', 32);
40
-            $table->string('majho_hook_name', 64);
41
-            $table->integer('majho_hook_order')->nullable();
42
-
43
-            $table->primary(['majho_module_name', 'majho_hook_name']);
44
-        });
45
-
46
-        if ($in_transaction && !DB::connection()->getPdo()->inTransaction()) {
47
-            DB::connection()->beginTransaction();
48
-        }
49
-    }
26
+	/**
27
+	 * {@inheritDoc}
28
+	 * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade()
29
+	 */
30
+	public function upgrade(): void
31
+	{
32
+		$in_transaction = DB::connection()->getPdo()->inTransaction();
33
+
34
+		if (DB::schema()->hasTable('maj_hooks')) {
35
+			DB::schema()->drop('maj_hooks');
36
+		}
37
+
38
+		DB::schema()->create('maj_hook_order', static function (Blueprint $table): void {
39
+			$table->string('majho_module_name', 32);
40
+			$table->string('majho_hook_name', 64);
41
+			$table->integer('majho_hook_order')->nullable();
42
+
43
+			$table->primary(['majho_module_name', 'majho_hook_name']);
44
+		});
45
+
46
+		if ($in_transaction && !DB::connection()->getPdo()->inTransaction()) {
47
+			DB::connection()->beginTransaction();
48
+		}
49
+	}
50 50
 }
Please login to merge, or discard this patch.