Passed
Push — master ( 4e42f9...eb61a8 )
by Jonathan
03:42
created

TranslationToolModule::loadRoutes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 13
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
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-2020, 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\ModuleConfigInterface;
21
use MyArtJaub\Webtrees\Module\AbstractModuleMaj;
22
use MyArtJaub\Webtrees\Module\TranslationTool\Http\RequestHandlers\TranslationStatus;
23
24
/**
25
 * MyArtJaub Translation tool Module.
26
 * This module helps with managing translations introduced by the MyArtJaub modules.
27
 */
28
class TranslationToolModule extends AbstractModuleMaj implements ModuleConfigInterface
29
{
30
    /**
31
     * {@inheritDoc}
32
     * @see \Fisharebest\Webtrees\Module\AbstractModule::title()
33
     */
34
    public function title(): string
35
    {
36
        return I18N::translate('Translation Tool');
37
    }
38
    
39
    /**
40
     * {@inheritDoc}
41
     * @see \Fisharebest\Webtrees\Module\AbstractModule::description()
42
     */
43
    public function description(): string
44
    {
45
        return I18N::translate('Manage webtrees translation.');
46
    }
47
    
48
    public function customModuleVersion(): string
49
    {
50
        return '2.0.6-v.1';
51
    }
52
    
53
    /**
54
     * {@inheritDoc}
55
     * @see \MyArtJaub\Webtrees\Module\AbstractModuleMaj::customModuleSupportUrl()
56
     */
57
    public function customModuleSupportUrl(): string
58
    {
59
        return 'https://github.com/jon48/webtrees-mod-translationtool';
60
    }
61
    
62
    /**
63
     * {@inheritDoc}
64
     * @see \MyArtJaub\Webtrees\Module\AbstractModuleMaj::loadRoutes()
65
     */
66
    public function loadRoutes(Map $router): void
67
    {
68
        $router->attach('', '', static function (Map $router) {
69
70
            
71
            $router->attach('', '/module-maj/translationtool', static function (Map $router) {
72
73
                $router->extras([
74
                    'middleware' => [
75
                        AuthAdministrator::class,
76
                    ],
77
                ]);
78
                $router->get(TranslationStatus::class, '/status', TranslationStatus::class);
79
            });
80
        });
81
    }
82
    
83
    /**
84
     * {@inheritDoc}
85
     * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink()
86
     */
87
    public function getConfigLink(): string
88
    {
89
        return route(TranslationStatus::class);
90
    }
91
}
92