Passed
Pull Request — master (#135)
by Romain
03:12
created

IndexModuleHandler   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 41
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getDefaultControllerName() 0 3 1
A registerEntityNotificationControllers() 0 18 2
A getModuleName() 0 3 1
1
<?php
2
3
/*
4
 * Copyright (C) 2018
5
 * Nathan Boiron <[email protected]>
6
 * Romain Canon <[email protected]>
7
 *
8
 * This file is part of the TYPO3 NotiZ project.
9
 * It is free software; you can redistribute it and/or modify it
10
 * under the terms of the GNU General Public License, either
11
 * version 3 of the License, or any later version.
12
 *
13
 * For the full copyright and license information, see:
14
 * http://www.gnu.org/licenses/gpl-3.0.html
15
 */
16
17
namespace CuyZ\Notiz\Backend\Module;
18
19
use CuyZ\Notiz\Service\Traits\ExtendedSelfInstantiateTrait;
20
21
class IndexModuleHandler extends ModuleHandler
22
{
23
    use ExtendedSelfInstantiateTrait;
24
25
    /**
26
     * @return string
27
     */
28
    public function getDefaultControllerName()
29
    {
30
        return 'Backend\\Manager\\ListNotificationTypes';
31
    }
32
33
    /**
34
     * @return string
35
     */
36
    public function getModuleName()
37
    {
38
        return 'NotizNotiz_NotizNotizIndex';
39
    }
40
41
    /**
42
     * Dynamically registers the controllers for existing entity notifications.
43
     */
44
    public function registerEntityNotificationControllers()
45
    {
46
        $controllers = [
47
            'Backend\\Manager\\Notification\\ShowEntityEmail' => [
48
                'show',
49
                'preview',
50
                'previewError',
51
            ],
52
            'Backend\\Manager\\Notification\\ShowEntityLog' => [
53
                'show',
54
            ],
55
            'Backend\\Manager\\Notification\\ShowEntitySlack' => [
56
                'show',
57
            ],
58
        ];
59
60
        foreach ($controllers as $controller => $actions) {
61
            $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions']['Notiz']['modules'][$this->getModuleName()]['controllers'][$controller] = ['actions' => $actions];
62
        }
63
    }
64
}
65