Passed
Branch feature/code-analysis (eb61a8)
by Jonathan
06:01
created

TranslationToolModule   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 12
c 1
b 0
f 0
dl 0
loc 62
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A customModuleVersion() 0 3 1
A getConfigLink() 0 3 1
A loadRoutes() 0 13 1
A customModuleSupportUrl() 0 3 1
A description() 0 3 1
A title() 0 3 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