Passed
Push — main ( 8cb778...cbddc8 )
by Jonathan
03:08
created

TranslationToolModule::isEnabledByDefault()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * webtrees-mod-translationtool: MyArtJaub Translation Tool Module for webtrees
5
 *
6
 * @package MyArtJaub\Webtrees\Module
7
 * @subpackage TranslationTool
8
 * @author Jonathan Jaubart <[email protected]>
9
 * @copyright Copyright (c) 2016-2022, Jonathan Jaubart
10
 * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3
11
 */
12
13
declare(strict_types=1);
14
15
namespace MyArtJaub\Webtrees\Module\TranslationTool;
16
17
use Aura\Router\Map;
18
use Fisharebest\Webtrees\I18N;
19
use Fisharebest\Webtrees\Http\Middleware\AuthAdministrator;
20
use Fisharebest\Webtrees\Module\AbstractModule;
21
use Fisharebest\Webtrees\Module\ModuleConfigInterface;
22
use Fisharebest\Webtrees\Module\ModuleConfigTrait;
23
use MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface;
24
use MyArtJaub\Webtrees\Module\ModuleMyArtJaubTrait;
25
use MyArtJaub\Webtrees\Module\TranslationTool\Http\RequestHandlers\TranslationStatus;
26
27
/**
28
 * MyArtJaub Translation tool Module.
29
 * This module helps with managing translations introduced by the MyArtJaub modules.
30
 */
31
class TranslationToolModule extends AbstractModule implements ModuleMyArtJaubInterface, ModuleConfigInterface
32
{
33
    use ModuleMyArtJaubTrait;
34
    use ModuleConfigTrait;
35
36
    /**
37
     * {@inheritDoc}
38
     * @see \Fisharebest\Webtrees\Module\AbstractModule::title()
39
     */
40
    public function title(): string
41
    {
42
        return I18N::translate('Translation Tool');
43
    }
44
45
    /**
46
     * {@inheritDoc}
47
     * @see \Fisharebest\Webtrees\Module\AbstractModule::description()
48
     */
49
    public function description(): string
50
    {
51
        return I18N::translate('Manage webtrees translation.');
52
    }
53
54
    public function customModuleVersion(): string
55
    {
56
        return '2.1.1-v.1';
57
    }
58
    
59
    /**
60
     * {@inheritDoc}
61
     * @see \Fisharebest\Webtrees\Module\AbstractModule::isEnabledByDefault()
62
     */
63
    public function isEnabledByDefault(): void
64
    {
65
        return false;
0 ignored issues
show
Bug Best Practice introduced by
The expression return false returns the type false which is incompatible with the type-hinted return void.
Loading history...
66
    }
67
68
    /**
69
     * {@inheritDoc}
70
     * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleSupportUrl()
71
     */
72
    public function customModuleSupportUrl(): string
73
    {
74
        return 'https://github.com/jon48/webtrees-mod-translationtool';
75
    }
76
77
    /**
78
     * {@inheritDoc}
79
     * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes()
80
     */
81
    public function loadRoutes(Map $router): void
82
    {
83
        $router->attach('', '', static function (Map $router): void {
84
85
86
            $router->attach('', '/module-maj/translationtool', static function (Map $router): void {
87
88
                $router->extras([
89
                    'middleware' => [
90
                        AuthAdministrator::class,
91
                    ],
92
                ]);
93
                $router->get(TranslationStatus::class, '/status', TranslationStatus::class);
94
            });
95
        });
96
    }
97
98
    /**
99
     * {@inheritDoc}
100
     * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink()
101
     */
102
    public function getConfigLink(): string
103
    {
104
        return route(TranslationStatus::class);
105
    }
106
}
107