Completed
Push — master ( ec0b76...22789e )
by Craig
06:04
created

UserManagementUiHooksSubscriber::getEvents()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 9

Duplication

Lines 12
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 9
c 0
b 0
f 0
nc 1
nop 0
dl 12
loc 12
rs 9.4285
1
<?php
2
3
/*
4
 * This file is part of the Zikula package.
5
 *
6
 * Copyright Zikula Foundation - http://zikula.org/
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Zikula\UsersModule\HookSubscriber;
13
14
use Zikula\Bundle\HookBundle\Category\UiHooksCategory;
15
use Zikula\Bundle\HookBundle\HookSubscriberInterface;
16
use Zikula\Common\Translator\TranslatorInterface;
17
18 View Code Duplication
class UserManagementUiHooksSubscriber implements HookSubscriberInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
19
{
20
    const EDIT_DISPLAY = 'users.ui_hooks.user.display_view';
21
    const EDIT_FORM = 'users.ui_hooks.user.form_edit';
22
    const EDIT_VALIDATE = 'users.ui_hooks.user.validate_edit';
23
    const EDIT_PROCESS = 'users.ui_hooks.user.process_edit';
24
    const DELETE_FORM = 'users.ui_hooks.user.form_delete';
25
    const DELETE_VALIDATE = 'users.ui_hooks.user.validate_delete';
26
    const DELETE_PROCESS = 'users.ui_hooks.user.process_delete';
27
28
    /**
29
     * @var TranslatorInterface
30
     */
31
    private $translator;
32
33
    /**
34
     * @param TranslatorInterface $translator
35
     */
36
    public function __construct(TranslatorInterface $translator)
37
    {
38
        $this->translator = $translator;
39
    }
40
41
    public function getOwner()
42
    {
43
        return 'ZikulaUsersModule';
44
    }
45
46
    public function getCategory()
47
    {
48
        return UiHooksCategory::NAME;
49
    }
50
51
    public function getTitle()
52
    {
53
        return $this->translator->__('User management hooks');
54
    }
55
56
    public function getEvents()
57
    {
58
        return [
59
            UiHooksCategory::TYPE_DISPLAY_VIEW => self::EDIT_DISPLAY,
60
            UiHooksCategory::TYPE_FORM_EDIT => self::EDIT_FORM,
61
            UiHooksCategory::TYPE_VALIDATE_EDIT => self::EDIT_VALIDATE,
62
            UiHooksCategory::TYPE_PROCESS_EDIT => self::EDIT_PROCESS,
63
            UiHooksCategory::TYPE_FORM_DELETE => self::DELETE_FORM,
64
            UiHooksCategory::TYPE_VALIDATE_DELETE => self::DELETE_VALIDATE,
65
            UiHooksCategory::TYPE_PROCESS_DELETE => self::DELETE_PROCESS,
66
        ];
67
    }
68
}
69